© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
L. E. HughesPro Active Directory Certificate Serviceshttps://doi.org/10.1007/978-1-4842-7486-6_16

16. Issue and Manage S/MIME Secure Email Certificates

Lawrence E. Hughes1  
(1)
Frisco, TX, USA
 

S/MIME is an IETF open standard (currently specified in RFC 8551, “Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 Message Specification,” April 2019). It is based on S/MIME personal digital certificates created by a trusted Public Key Infrastructure (PKI). Each participant must obtain a unique S/MIME Certificate that identifies themselves. That cert must be trusted by all other parties that they will be communicating with. S/MIME allows adding a digital signature (for message integrity and detection of tampering) and/or a digital envelope (for privacy) to any Internet email message. These messages can be delivered in various ways, including over SMTP via existing email servers. The messages pass transparently through these servers. Secure messages are created on the sending node and opened on the receiving node. This provides true end-to-end privacy and sender-to-recipient authentication.

An S/MIME Digital Certificate is similar to a TLS Client Certificate. It is used for S/MIME secure email. There are two primary differences between a TLS Client Certificate and an S/MIME Certificate:
  • For a TLS Client Certificate, the X.509 Enhanced Usage field must have the Client Authentication flag set (as opposed to the Server Authentication flag in a TLS Server Certificate). In an S/MIME Certificate, the Enhanced Usage field must have the Email Security flag set.

  • For an S/MIME Certificate, the X.509 Subject Alternative Name field must contain an RFC822 name which is the user’s email address, for example, RFC822Name = [email protected]. There is no need for any Subject Alternative Name field in a TLS Client Certificate, but the presence of one does not interfere with its use for TLS SCA.

It is possible to create a single certificate that will work for both TLS SCA and S/MIME by setting both Enhanced Usage flags and the Subject Alternative Name. I call that a “dual use” or “dual purpose” certificate.

Normally for S/MIME secure email, you would want for each user to obtain a “public hierarchy” S/MIME Certificate. A public hierarchy digital certificate is one that chains up to a Trusted Root Certificate that has been approved by WebTrust and is automatically installed in all leading operating systems. Such certificates are issued by a public Certification Authority, such as DigiCert, GlobalSign, Entrust, or Sectigo (formerly Comodo).

However, for use within a closed group (e.g., in-company secure email), you can use “private hierarchy” S/MIME Certificates (either issued by a public CA or an in-house CA, like Microsoft Active Directory Certificate Services ). Private hierarchy digital certificates chain up to a Root Certificate that must somehow be installed in all relying nodes, since it is not installed automatically in all leading operating systems. Once that Root Cert is installed in a computer’s Certificate Store, the private hierarchy certificate works just like a public hierarchy certificate on that computer. The Root Certificate can be deployed in all nodes in an organization in various ways. With Microsoft Active Directory Certificate Services, the Root Certificate is deployed automatically to all nodes that are members of the Microsoft Domain involved.

Issuing S/MIME Digital Certificates with Microsoft AD CS

We will now configure Microsoft Active Directory Certificate Services to issue S/MIME Client Certificates that can be used to deploy S/MIME secure email. For S/MIME secure email, each user must obtain a unique S/MIME Certificate that identifies them. In an S/MIME Certificate, the Subject Distinguished Name field identifies a particular person in the world, as opposed to some server node name. An S/MIME Certificate can be used from any node – it is not tied to a node name as a server certificate is. Note that to use S/MIME secure email, each user must have access to their own private key on every node that they will be using to sign outgoing emails or receiving incoming encrypted emails. In addition, when sending an S/MIME encrypted email, the sender needs access to the current S/MIME Certificate for all recipients of that message. This can be accomplished via a shared address book (e.g., in Active Directory) that contains the S/MIME Certificate for all users. It helps if that shared address book is built automatically as S/MIME Certificates are issued by the CA.

Note that while only one TLS Server Certificate is needed regardless of how many people use that secure server, with S/MIME secure email, every user must be issued a unique S/MIME Certificate that identifies that user. There are several vendors that provide automated systems for providing large numbers of users with S/MIME Certificates, including building a shared address book in AD, and even optional private key escrow. Sixscape Communications provides such a system.

You can export your key material (S/MIME Certificate and private key) in PKCS #12 format and import it on another node (e.g., use your work key material from home or from any other computer). It is possible to import your key material into a hardware token (USB or smart card). If the key material is created inside the token from the start, there is no way to back up the key material (the private key can never be exported from the hardware token). You can move the token (containing the key material) to another computer, but it can only be used from one computer at a time. Alternatively, you can obtain the key material in PKCS #12 form, back it up, and then import the PKCS #12 file into a hardware token (or any number of hardware tokens). This allows you to restore your S/MIME Certificate and create a new hardware token from the PKCS #12 file in the event the original hardware token is lost.

If you are only going to use your key material for digital signatures, there is no need to back up your key material, so it is acceptable to create the key pair and certificate inside a hardware token (a new one with a different key pair can easily be created and used if the current key material is lost). If you are going to use your key material for encryption, then you should back up the key material. In that case, it is not recommended to create the key material and certificate directly inside a hardware token. If the private key is lost, all files encrypted by the corresponding digital certificate are unrecoverable.

We will create a new certificate template for S/MIME Certificates that has only the Email Security flag set and the user’s RFC822 Name (email address) in the Subject Alternative Name.

Note with any client certificate type, you can include various fields in the Subject Distinguished Name , from the following choices.

CN

CommonName

User’s full name (e.g., Lawrence Hughes)

E

EmailAddress

User’s email address (e.g., [email protected])

O

Organization

User’s organization (e.g., PKIEdu Inc.)

OU

Organization unit

User’s department (e.g., IT)

L

Locality

User’s city (e.g., Frisco)

ST

State

User’s state or province (e.g., Texas)

C

Country

User’s country (e.g., US)

There are numerous other fields possible in a Subject Distinguished Name, but each item included must be validated by the Registration Authority before the certificate is issued by the Certification Authority. With public CAs, the more fields in your SubjectDN, the more the CA charges for the cert, because most of their cost is in verification of your identity. With AD CS, this verification is done by your PKI administrator.

The next step is to create a certificate template for issuing certificates for S/MIME secure email. This is like a TLS Client Certificate, with the following changes:
  • Enhanced Usage flags – Instead of Client Authentication flag, set the Email Security flag.

  • Subject Alternative Name – Must contain the user’s email address as an RFC822 Name.

  • Subject Distinguished Name – As with TLS Client Certificate, it specifies a person or device. This can have any of the fields listed earlier (CN, E, O, OU, L, ST, or C).

Create Template for S/MIME Certificate

On the VM running your subordinate CA (in my case, intca.us.hughes.org), in Server Manager, click Tools/Certification Authority. This will start certsrv.

Expand PKIEdu Int CA. Expand Certificate Templates. You should see the following (Figure 16-1).
Figure 16-1

Certificate Templates list

Right-click Certificate Templates and choose Manage. You should see the following (Figure 16-2)
Figure 16-2

Manage

Right-click User and select Duplicate Template. You should see the following (Figure 16-3).
Figure 16-3

Properties of New Templates

Click the General tab.

Set the Template display name to S/MIME Certificate. This will change the Template name to S/MIMECertificate.

Set the Validity period to one year.

Select Publish certificate in Active Directory.

It should look like this (Figure 16-4).
Figure 16-4

Do not click OK yet

Select the Subject Name tab.

Select Build from this Active Directory information.

Select Subject name format as Fully distinguished name.

Select Include e-mail name in subject name.

Under Include this information in alternate subject name, select E-mail name and User principal name.

It should look like this (Figure 16-5).
Figure 16-5

Do not click OK yet

Select the Extensions tab.

You will see that the Application Policies are currently set to Encrypting File System, Secure Email, and Client Authentication. See Figure 16-6.
Figure 16-6

Application Policies

Only Secure Email is required. Click Edit.

You should now see the Extension policies. Highlight Encrypting File System and Client Authentication and click Remove. You should now see the following (Figure 16-7).
Figure 16-7

Click OK

You should now see the final New Template Properties. See Figure 16-8.
Figure 16-8

Now you can click OK

There is now a new template called S/MIME Certificate, as shown in Figure 16-9.
Figure 16-9

S/MIME Certificate

You can now dismiss the Certificate Templates Console (X in upper-right corner).

Prepare for Issuing S/MIME Certificates

In the Certification Authority app, right-click Certificate Templates and select New/Certificate Template to issue. From the list of certificate templates, find S/MIME Certificate. See Figure 16-10.
Figure 16-10

Certification Authority app

Select S/MIME Certificate by clicking it, and then click OK. This will enable your new S/MIME Certificate Template to issue certificates.

Now right-click Certificate Templates and select Manage.

Find S/MIME Certificate in the list of templates. Right-click it and select Properties.

Select the Security tab.

You should see the following (Figure 16-11).
Figure 16-11

S/MIME Certificate Properties

Select who you want to be able to enroll S/MIME Certificates (e.g., Authenticated Users), and select Read and Enroll. Click Apply.

It will now look like this (Figure 16-12).
Figure 16-12

Choose “Read” and “Enroll”

Click OK.

Request and Obtain an S/MIME Certificate Using mmc.exe

The next step is to use mmc.exe to request an S/MIME Certificate for Administrator (the currently logged in user).

Start mmc.exe by selecting Start/Run and entering mmc.exe.

Click File/Add/Remove Snap-in. Select Certificates and then click Add. Select My user account. Click Finish. It should now look like the following (Figure 16-13).
Figure 16-13

Add or Remove Snap-ins

Click OK. Certificates. Expand Personal. Expand Certificates.

You should see the following (Figure 16-14).
Figure 16-14

Expand Certificates

Before requesting an S/MIME Cert for Administrator, make sure there is an email account for that user (e.g., administrator@hughesnet.​org). I host the email for hughesnet.org at Rackspace, so I just added a new user there. Alternatively, you could create an S/MIME Cert for any existing email account.

Right-click the middle pane, and select All Tasks/Request New Certificate.

Ignore the Before You Begin page. Click Next. You should now see the following (Figure 16-15).
Figure 16-15

Click Next

You should now see the following (Figure 16-16).
Figure 16-16

Request Certificates

Select S/MIME Certificate. Expand Details. See Figure 16-17.
Figure 16-17

Expand details

Click Properties. Select the Private Key tab. Make sure the private key is exportable (Figure 16-18).
Figure 16-18

Click OK

Click Enroll.

You should now see the following (Figure 16-19).
Figure 16-19

Certificate Installation Results

Congratulations, you have just issued an S/MIME Certificate for the current user (Administrator). Click Finish.

In mmc.exe, you should now see the new certificate (Figure 16-20).
Figure 16-20

New certificate

Note that one of them is for Secure Email. Double-click that one to view its properties (Figure 16-21).
Figure 16-21

Certificate Information

It was issued to Administrator.

It was issued (signed) by PKIEdu Int CA.

The ValidFrom date is the date of issue (when I issued this cert).

The ValidTo date is one year from then.

You have a private key that corresponds to this certificate.

Now select the Details tab.

Under Subject, you should see
      E = [email protected]
      CN = Administrator
      CN = Users
      DC = us
      DC = hughesnet
      DC = org
Under Issuer, you should see
      CN = PKIEdu Int CA
      DC = us
      DC = hughesnet
      DC = org
Under Enhanced Key Usage, you should see
      Secure Email (1.3.6.1.5.5.7.3.4)

Under CRL Distribution Point, you should see an LDAP URL pointing to your AD server.

Under Subject Alternative Name, should you see
      Other Name:
           Principal [email protected]
      RFC822 [email protected]

This is exactly what you need for an S/MIME Certificate.

Now select the Certification Path tab. You should see the following (Figure 16-22).
Figure 16-22

Certificate Path tab

The new certificate chains up to the PKI Int CA Intermediate Cert. The PKI Int CA Intermediate Cert chains up to the PKIEdu Root CA Root Cert, which is trusted. This is a three-level hierarchy.

Congratulations! You have just issued an S/MIME Certificate for Administrator.

Test Your New S/MIME Certificate

To test this, you must have Outlook installed on any node in your domain, with an account for [email protected] (or whatever your domain is). In my case, this account is hosted at Rackspace, as an IMAP account. Verify you can send an email to yourself.

If you are not doing this on your Subordinate CA server, you can export the cert and copy it to the node where you have Outlook installed. Alternatively, you can request another S/MIME Cert on the node where Outlook is installed. One way or another, the S/MIME Cert must be on the node where you are running Outlook.

Now configure that account to use S/MIME. This is a bit complicated.

In Outlook, select the File menu. You will see something like this (Figure 16-23).
Figure 16-23

Outlook “File” menu

Click Options at lower left. You will see the following (Figure 16-24).
Figure 16-24

Options

Click Trust Center at lower left. In the right pane, click Trust Center Settings.

You will now see the following (Figure 16-25).
Figure 16-25

Trust Center options

In the left pane, click Email Security.

You will now see the following (Figure 16-26).
Figure 16-26

Email Security

Under Encrypted email, click the Settings button.

You will now see something like this (Figure 16-27).
Figure 16-27

Encrypted email settings

Change the hash algorithm to SHA256 (SHA1 was deprecated some time ago). Your S/MIME Cert for Administrator was selected (being the only one found).

Click OK. Dismiss the Trust Center dialog with OK. Dismiss the Outlook Options dialog with OK. See Figure 16-28.
Figure 16-28

Create a new email

Create a Digitally Signed Email

Create a new email (top left corner) to [email protected] (to your account).

In the top menu, select Options. See Figure 16-29.
Figure 16-29

Options

Click the Sign option and send the message.

In a few seconds, the signed message will appear in your Inbox. See Figure 16-30.
Figure 16-30

Signed message

Notice the red ribbon icon in the reading pane. Click it to see details (Figure 16-31).
Figure 16-31

Digital signature

The signature is valid. The message is from [email protected] and was signed by [email protected].

Click Details. See Figure 16-32.
Figure 16-32

Message Security Properties

Click the Signer line (Figure 16-33).
Figure 16-33

Click “Signer” line

This message was signed by [email protected] on 11/21/2021.

Click View Details. See Figure 16-34.
Figure 16-34

Signature Information

Click View Certificate. See Figure 16-35.
Figure 16-35

This is the S/MIME Cert we just created

Send a Digitally Enveloped Message

To do this, we need to capture our digital cert in a contact. In the reading pane, right-click the recipient, and select Add to Outlook Contacts. You will see the following (Figure 16-36).
Figure 16-36

Add to Outlook Contacts

Click Show/Certificates (Figure 16-37).
Figure 16-37

Show/Certificates

You can see that it captured the certificate from the signed message in our Outlook contacts.

Click Save and Close.

Now create another new email (Figure 16-38).
Figure 16-38

Create new email

Click the To button. See Figure 16-39.
Figure 16-39

Click “To” button

The administrator contact we created is now there. Click the To button at the bottom to use it as the recipient.

Click OK.

Add a subject line and message (Figure 16-40).
Figure 16-40

Add subject line and message

Click the Options item in the top menu. Select both Encrypt and Sign. See Figure 16-41.
Figure 16-41

Select “Encrypt” and “Sign”

Send the message. If the send fails, it didn’t find the recipient’s certificate.

Assuming everything went well, the new message will appear in your Inbox (Figure 16-42).
Figure 16-42

Message shown in Inbox

Note the new message in the reading pane has both the padlock (encrypted) and seal (signed).

Click the padlock icon (Figure 16-43).
Figure 16-43

Padlock icon

There are now both Encryption and Signature layers.

Click Details. See Figure 16-44.
Figure 16-44

Details

Click the Encryption Layer. See Figure 16-45.
Figure 16-45

Encryption Layer

The message was encrypted using AES256, for [email protected].

Now click the Signer line (Figure 16-46).
Figure 16-46

Signer line

The message was signed by the sender, using RSA/SHA256.

You can see the signer’s certificate via View Details as before.

As you can see, we have created a valid S/MIME Certificate using Active Directory Certificate Services and sent both signed and encrypted emails using it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.112.56