You are on page 1of 28

Microsoft AD CS and

OCSP Integration Guide


Microsoft Windows Server 2012
Version: 1.2

Date: 31 October 2013

Copyright © 2013 Thales e-Security Limited. All rights reserved.

Copyright in this document is the property of Thales e-Security Limited. It is not to be reproduced,
modified, adapted, published, translated in any material form (including storage in any medium
by electronic means whether or not transiently or incidentally) in whole or in part nor disclosed to
any third party without the prior written permission of Thales e-Security Limited neither shall it be
used otherwise than for the purpose for which it is supplied.

Words and logos marked with ® or ™ are trademarks of Thales e-Security Limited or its affiliates
in the EU and other countries.

Information in this document is subject to change without notice.

Thales e-Security Limited makes no warranty of any kind with regard to this information,
including, but not limited to, the implied warranties of merchantability and fitness for a particular
purpose. Thales e-Security Limited shall not be liable for errors contained herein or for incidental
or consequential damages concerned with the furnishing, performance or use of this material.

Microsoft AD CS and OCSP Integration Guide 2


Contents

Contents
Contents 3

Chapter 1: Introduction 5

Product configurations 5

Supported Thales nShield functionality 5

Requirements 6

This guide 6

More information 6

Chapter 2: Procedures 7

Installing the HSM 7

Installing the software and creating or sharing the security world 7

Installing and configuring AD CS 8

Verifying that the CA service has started successfully 9

Installing and configuring AD CS on Windows Server Core 10

Verifying that the CA service has started successfully 11

Installing and configuring AD CS via PowerShell 11

Configuring auto-enrollment group policy for a domain 12

Configuring the Thales nShield HSM with Certificate Services 13

Configuring Certificate Services with a new key 13

Configuring Certificate Services using an existing private key 13

Configuring Certificate Enrollment to use CA templates 14

Setting up key use counting 15

Key use counter overview 15

Installing Certificate Services with key use counting 15

CA Backup, migrate and restore 16

Backing up, migrating and restoring CA using an existing certificate and its associated
private key 17

Backing up, migrating and restoring the CA using an existing private key 19

Microsoft AD CS and OCSP Integration Guide 3


Contents

Installing the OCSP 20

Configuring the CA to issue an OCSP Response Signing Certificate 21

Configuring certificate templates for your environment 21

Configuring the CA to support the Online Responder service 22

Requesting a certificate from OCSP Response Signing template 22

Verifying that the signing certificate is properly configured 23

Modifying the Online Responder service to use an Thales HSM 23

Setting up a revocation configuration 23

Verifying that OCSP works correctly 24

Generating a certificate request 24

Removing information about the certificate's CRL 25

Retrieving information about the certificate's AIA, CRLs, and OCSP 25

Verifying the OCSP Server is Active 26

Uninstalling AD CS and OCSP 26

Chapter 3: Troubleshooting 27

Addresses 28

Microsoft AD CS and OCSP Integration Guide 4


Chapter 1: Introduction

Chapter 1: Introduction
Microsoft Active Directory Certificate Services (AD CS) provides the functionality for creating and
installing a Certificate Authority (CA). The CA acts as a trusted third-party that certifies the
identity of clients to anyone who receives a digitally signed message. The CA may issue, revoke,
and manage digital certificates.

The Online Responder is a Microsoft Windows Service that implements the Online Certificate
Status Protocol (OCSP) by decoding revocation status requests for specific certificates. The
service provides up-to-date validation of certificates, and sends back a signed response
containing the requested certificate status information. OCSP is used to provide real-time
information about a certificate's status.

The CA and OCSP use the Thales nShield Hardware Security Module (HSM) to protect their private
keys.

Note: Throughout this guide, the term HSM refers to nShield® Solo™ modules (formerly
known as nShield PCI and PCIe), nShield Connect™ (and legacy netHSMs), and nShield
Edge™ products.

They also use the HSM for important operations such as key generation, certificate signing, and
CRL signing. The Thales HSM can can be configured to protect the private keys and meet Federal
Information Processing Standards (FIPS) 140-2 level 2 or level 3.

Product configurations
We have successfully tested Thales' HSM integration with AD CS in the following configurations:

Thales
Security nShield nShield
Operating AD CS OCSP nShield Solo
World Connect Edge
system version version support
Software support support
version
Microsoft
Windows
Server 2012
(Standard 6.2 1.0 11.61 Yes Yes Yes
and
Datacenter
editions)

Supported Thales nShield functionality


Soft cards — Key management Yes FIPS 140-2 level 3 Yes
Key recovery Yes Module-only key Yes K-of-N card set Yes
Load balancing Yes Key import Yes Fail over Yes

Microsoft AD CS and OCSP Integration Guide 5


Requirements

Note: CA failover clustering is only supported with network attached HSMs (nShield Connect).

Requirements
Before installing the software, we recommend that you familiarize yourself with the Microsoft AD
CS and OCSP documentation and setup processes, and that you have the Thales nShield
documentation available. We also recommend that you have an agreed organizational Certificate
Practices Statement and a Security Policy/Procedure in place covering administration of the PKI
and HSM.

In particular, these documents should specify the following aspects of HSM administration:

l The number and quorum of Administrator Cards in the Administrator Card Set (ACS), and
the policy for managing these cards
l Whether the application keys are protected by the module or an OCS
l The number and quorum of Operator Cards in the OCS, and the policy for managing these
cards
l Whether the security world should be compliant with FIPS 140-2 level 3
l Key attributes such as the key size and time-out
l Whether there is any need for auditing key usage
l Whether to use the Thales Cryptographic Service Providers for Microsoft Cryptographic API:
Next Generation (CNG) or CryptoAPI (CAPI)
l Whether to initialize the nShield Security World as Recoverable; this is highly
recommended.

Note: We recommend that you use CNG for full access to available features and better
integration with Windows Server 2012.

This guide
This guide describes how to configure AD CS and OCSP with the Thales' nShield Hardware
Security Module (HSM), and set up a root CA. We have tested the instructions, which provide a
straightforward integration process. There may be other untested ways to achieve
interoperability. This guide might not cover every step of the hardware and software setup
process.

This guide assumes that you are familiar with the Thales HSM documentation and the setup
process for AD CS and OCSP. For more information about installing the AD CS and OCSP, refer to
the Microsoft documentation.

More information
l For more information about OS support, contact your Microsoft sales representative or
Thales Support.
l For more information about contacting Thales, see Addresses at the end of this guide.
l Additional documentation produced to support your Thales product is in the document
directory of the CD-ROM or DVD-ROM for that product.
l For more information about HSM administration, refer to the User Guide for the HSM.

Microsoft AD CS and OCSP Integration Guide 6


Chapter 2: Procedures

Chapter 2: Procedures
Integration procedures include:

l Installing the HSM (page 7)


l Installing the software and creating or sharing the security world (page 7)
l Installing and configuring AD CS (page 8)
l Installing and configuring AD CS on Windows Server Core (page 10)
l Installing and configuring AD CS via PowerShell (page 11)
l Configuring auto-enrollment group policy for a domain (page 12)
l Configuring the Thales nShield HSM with Certificate Services (page 13)
l Configuring Certificate Enrollment to use CA templates (page 14)
l Setting up key use counting (page 15)
l CA Backup, migrate and restore (page 16)
l Installing the OCSP (page 20)
l Configuring the CA to issue an OCSP Response Signing Certificate (page 21)
l Setting up a revocation configuration (page 23)
l Verifying that OCSP works correctly (page 24)
l Uninstalling AD CS and OCSP (page 26)

This chapter describes these procedures.

Installing the HSM


Install the HSM using the instructions in the Hardware Installation Guide for the HSM. We
recommend that you install the HSM before configuring the Security World Software, and before
installing and configuring AD CS and OCSP.

If you already have an HSM installed and a security world configured, proceed to Installing and
configuring AD CS on page 8.

Installing the software and creating or sharing the


security world
To install the Security World Software and create the security world:

1. Install the latest version of the Security World Software as described in the User Guide for
the HSM.
Note: We recommend that you always uninstall any existing Security World Software
before installing the new Security World Software.
2. Initialize a security world as described in the User Guide for the HSM.
Note: You can also use the CSP Install Wizard or the CNG Configuration Wizard to create a
Security World for nShield Solo and nShield Edge HSMs. For nShield Connect, we
recommend that you use the front panel user interface to create the Security World.
3. Register the Cryptographic Service Providers that you intend to use.
Note: For CAPI on 64-bit Windows, both 32-bit and 64-bit CSP Install Wizards are available.
If you intend to use the CAPI CSPs from both 32-bit and 64-bit applications, or if you
are unsure, run both wizards. The CNG Configuration Wizard registers the CNG
Providers for use by both 32-bit and 64-bit applications where relevant. For detailed

Microsoft AD CS and OCSP Integration Guide 7


Installing and configuring AD CS

information on registering the CAPI CSPs or CNG Providers, refer to the User Guide
for the HSM.
4. If you are installing OCSP on a different server to the CA, install the Security World Software
on both servers (as described in the User Guide for the HSMs) and share the Security Worlds
by copying the %KMDATA% file from the CA server to the OCSP server. See the User Guide
for more information.

Installing and configuring AD CS


To install and configure Microsoft AD CS:

1. Click Start > Server Manager to open Server Manager.


2. Click Manage, then click Add Roles & Features. The Before you begin window opens.
Click Next.
3. On the Select installation type window, ensure the default selection of Role or Feature
Based Installation is selected and click Next.
4. On Server selection, select a server from the server pool and click Next.
5. On the Select server roles window, select the Active Directory Certificate Services
role.
6. When prompted to install Remote Server Administration Tools click Add Features, then
click Next.
7. On the Select features window, click Next.
8. On the Active Directory Certificate Services window, click Next.
9. On the Select role services window, the Certification Authority role is selected by
default. Click Next.
10. On the Confirm installation selections window, verify the information and click Install.
11. When the binary file installation is complete, click Configure Active Directory Certificate
Services on the destination server link.
12. On the Credentials window, ensure that Administrator's credentials is displayed in the
Credentials box. If not, click Change and specify the appropriate credentials. Click Next.
13. On the Role Services window, select Certification Authority. This is the only available
selection when only the binary files for the certification authority role are installed on the
server. Click Next.
14. On the Setup Type window, select the appropriate CA setup type for your requirements.
Click Next.
15. On the CA Type window, Root CA is selected by default. Click Next.
16. On the Private Key window, leave the default selection to Create a new private key
selected. Click Next.
17. On the Cryptography for CA window, select the appropriate Thales cryptographic provider
along with the key type, key length and suitable hash algorithm:
l RSA # nCipher Security World Key Storage Provider

l ECDSA_P256 #Security World Key Storage Provider

l ECDSA_P384 #Security World Key Storage Provider

l ECDSA_P521 #Security World Key Storage Provider

Click Next.
18. On the CA Name window, give the appropriate CA name and click Next.
19. On the Validity Period window, enter the number of years for the certificate to be valid and
click Next
20. On the CA Database window, leave the default locations for the database and database log
files. Click Next.
21. On the Confirmation window, click Configure.
22. If you select nCipher cryptographic service provider on the Cryptography for CA
window, the nCipher key storage provider-create a key wizard prompts you to create a

Microsoft AD CS and OCSP Integration Guide 8


Chapter 2: Procedures

new key. Click Next and On. Select a way to protect the new key. Click Next. Follow the
subsequent instructions and close the wizard.
The Progress window opens during the configuration processing, then the Results window
opens. Click Close. If the Installation progress window is still open, click Close on that
window also.
23. Verify that the CA service has started successfully by running the following command on the
command line. Use Windows key + R to open the Run dialog, and type cmd to open the
command prompt. Run the command:

>sc query certsvc

If CA is not started automatically then you need to enable Interactive Services Detection services.

To improve security, Windows Server 2012 does not allow Interactive Services Detection services
to display a window on your desktop. If your CA private key is protected by an OCS, Certificate
Services may need to display dialogs prompting you to insert Operator Cards or enter pass
phrases. In this case, the Interactive services dialog detection window opens and you must select
View the message.

To enable Interactive Services Detection services using the Windows registry:

1. Go to Run and type regedit.


2. Go to HKEY_LOCAL_MACHINE > System > CurrentControlSet > Control > Windows
3. Change the NoInteractiveService value from 1 to 0 and click OK.
4. Go to Services and verify that Interactive Services Detection service is started
manually.
5. Restart the machine and start the CA.
6. After installing AD CS, you must register nFast Server as a dependency of the CA service.
This ensures that the CNG or CAPI CSPs are available for use before the CA starts up.
Register nFast Server by running the command:

>ncsvcdep.exe -a certsvc

By default, the ncsvcdep.exe utility is installed in the %NFAST_HOME%\bin directory.

Verifying that the CA service has started successfully


To verify that the CA service has started, open a command prompt and run the command:

>sc query certsvc

Microsoft AD CS and OCSP Integration Guide 9


Installing and configuring AD CS on Windows Server Core

Installing and configuring AD CS on Windows Server


Core
To install the Certificate Server on Windows Server Core:

1. Join domain by running the command:

netdom join %computername% /domain:<full DNS domain name> /userd:<domain u


ser> /password:*

2. Restart the machine after joining the domain by running the command:

>shutdown /r /t 0

3. Enable WOW64 if you are working with 32-bit applications:

Start /w ocsetup ServerCore-WOW64


shutdown /r /t 0

4. Run PowerShell as admin user.


5. Install CA binaries via PowerShell, by running the command:

Add-windowsfeature ADCS-Cert-Authority

6. Configure CA via Powershell, by running the command:

Install-AdcsCertificationAuthority –AllowAdministratorInteraction –caTypeE


nterpriseRootCA
–CryptoProviderName ECDSA_P256#HSM_KSP_NAME –KeyLength 256 –HashAlgorithm
SHA256

Example:

Install-AdcsCertificationAuthority –AllowAdministratorInteraction –caCommo


nName "Fips-128-Module-CA-1"
–caTypeEnterpriseRootCA –CryptoProviderName "RSA#nCipher Security World Ke
y Storage Provider"
–KeyLength 2048 –HashAlgorithm SHA256

7. When the confirmation message appears, type A and press Enter.

Note: Use Module Only Protection or 1/N OCS without passphrase as a key protection method
for Windows Server Core.

Microsoft AD CS and OCSP Integration Guide 10


Chapter 2: Procedures

Verifying that the CA service has started successfully


To verify that the CA service has started, open a command prompt and run the command:

>sc query certsvc

Installing and configuring AD CS via PowerShell


This procedure installs the Certificate Server binaries via the Server Manager Powershell (PS)
cmdlets, and then configures the Certificate Server via the new PS deployment cmdlets.

To install and configure Microsoft Active Directory Certificate Services using PowerShell:

1. Run PowerShell as admin user.


2. Run the command:

Add-windowsfeature ADCS-Cert-Authority

Note: This command only installs CA binaries.


3. Configure CA. There are three parameter sets for the CA PowerShell deployment cmdlet:
a. Using new certificate and private key:
1. Run the following command in PowerShell:

Install-AdcsCertificationAuthority –AllowAdministratorInteraction –
caCommonName "<CA-Name>" –caType
EnterpriseRootCA –CryptoProviderName "<Key Storage Provider Name>"
–KeyLength <2048> –HashAlgorithm <SHA256>

Example:

Install-AdcsCertificationAuthority –AllowAdministratorInteraction –
caCommonName "Fips-128-Module-CA-1"
–caType EnterpriseRootCA –CryptoProviderName "RSA#nCipher Security
World Key Storage Provider"
–KeyLength 2048 –HashAlgorithm SHA256

2. When the confirmation message appears, type A and press Enter.

Microsoft AD CS and OCSP Integration Guide 11


Configuring auto-enrollment group policy for a domain

b. Using existing private key:


1. Run the following command in PowerShell:

Install-AdcsCertificationAuthority –AllowAdministratorInteraction –
caType EnterpriseRootCA –CryptoProviderName
ECDSA_P256#HSM_KSP_NAME –KeyContainerName NAME_OF_KEY –hashAlgorith
m SHA256

Example:

Install-AdcsCertificationAuthority –AllowAdministratorInteraction –
catype EnterpriseRootCA –CryptoProviderName
"RSA#nCipher Security World Key Storage Provider" –KeyContainerName
"Fips-128-Module-CA-1" –hashAlgorithm SHA256

2. When the confirmation message appears, type A and press Enter.


c. Using existing certificate and private key:
1. Using a certificate already present on local machine in MY store, run the command:

Install-AdcsCertificationAuthority –AllowAdministratorInteraction –
caType EnterpriseRootCA –certificateID
[cert hash | cert serial number]

Example:

Install-AdcsCertificationAuthority –AllowAdministratorInteraction –
caType EnterpriseRootCA –certificateID
"49177ae638cc948241947879ae66d315"

2. When the confirmation message appears, type A and pressEnter.

Configuring auto-enrollment group policy for a


domain
To complete the integration procedures, you must configure auto-enrollment as a group policy:

1. On the domain controller, click Start > Administrative Tools > Group Policy
Management.
2. Go to Forest, select your Domain and expand it.
3. Double-click Group Policy Objects in the forest and domain containing the Default Domain
Policy Group Policy object (GPO) that you want to edit.
4. Right-click the Default Domain Policy GPO, and then click Edit.
5. In the Group Policy Management Editor, click Computer Configuration > Policies >
Windows Settings > Security Settings > Public Key Policies.
6. Double-click Certificate Services Client - Auto-Enrollment.
7. In Configuration Model, click Enabled to enable auto-enrollment. Select the following
check boxes:

Microsoft AD CS and OCSP Integration Guide 12


Chapter 2: Procedures

n Renew expired certificates, update pending certificates, remove and revoke


certificates.
n Update certificates that use certificate template.

8. Click Apply and OK to accept your changes and close the Editor.

Configuring the Thales nShield HSM with Certificate


Services

Configuring Certificate Services with a new key


To install the Certificate Server using the Thales HSM Key Storage Provider (KSP):

1. Install and configure the Thales HSM hardware and software as described in the section
Installing the software and creating or sharing the security world on page 7.
2. Install Microsoft Active Directory Certificate Services and a CA as described in the section
Installing and configuring AD CS on page 8, with the following settings:
n In the Private Key window, click Create a new private key and click Next.

n Continue the CA setup as described in the section Installing and configuring AD CS on

page 8.

Configuring Certificate Services using an existing private key


To install the Certificate Server using the Thales HSM KSP with an existing HSM private key:

1. Install and configure the Thales HSM hardware and software as described in the section
Installing the software and creating or sharing the security world on page 7.
2. Install Microsoft Active Directory Certificate Services and a CA as described in the section
Installing and configuring AD CS on page 8.
3. In the Private Key window, select Use existing private key and then Select an existing
private key on this computer. Click Next.
4. In the Select Existing Key window, click Change.
5. In the Change Cryptographic Provider window, select the CSP that contains the created
key. Delete the contents of the field CA common name, and click Search. The search finds
the existing private key. Select the key, then select Allow administrator interaction
when the private key is accessed by the CA. Click Next.
6. In the Cryptography for CA window, select the appropriate hash algorithm and click Next.
7. In the CA Name window, click Next.
8. In the Validity Period window, specify the validity period and click Next.
9. In the CA Database window, specify the certificate database locations and certificate
database log locations and click Next.
10. In the Confirmation window, click Configure.
11. Wait for the configuration to complete. After successful completion, close the AD CS
configuration window.
12. Verify that the CA service has successfully started by running the command:

>sc query certsvc

Microsoft AD CS and OCSP Integration Guide 13


Configuring Certificate Enrollment to use CA templates

13. Verify the CA key by running the command:

>certutil -verifykeys

Configuring Certificate Enrollment to use CA


templates
To integrate the CA certificate enrollment functionality with a Thales HSM generated CA private
key:

1. Create a CA template that uses the Thales HSM KSP:


a. Run certtmpl.msc.
b. Right-click the Administrator template, and select Duplicate Template. The
Properties window opens, showing Compatability tab.
c. Select Windows Server 2012 Under Certificate Authority and Certificate
Recipient drop-down box.
The change window opens. Click OK.
d. Click the General tab. In Template display name, type a name for the template.
e. Click the Request Handling tab, and in Purpose select Signature and click Yes to
confirm changes to the certificate purpose.
f. Deselect Allow private key to be exported.
g. Click the Cryptography tab and in the Provider category select Key storage
provider.
h. In Algorithm Name, select an ECC or RSA algorithm.
i. Click Requests must use one of the following providers and in Providers, select
nCipher Security World Key Storage Provider only;
j. In Request Hash, select a hash type.
k. Click Subject Name tab and deselect Include e-mail name in subject name and
deselect E-mail name.
l. Click Apply and OK to save the template settings and close the Certificate Template
console.
2. Run certsrv.msc.
3. In the left-hand pane, double-click the CA name.
4. Right-click the Certificate Template node and select New > Certificate Template to
Issue.
5. Select the template you just created, and click OK.
6. Request a certificate based on the template:
a. Run certmgr.msc.
b. In the left-hand pane, right-click the Personal node, and select All Tasks > Request
New Certificate.
c. Click Next and Next to pass through the first two windows.
d. Select the template that you created, and click Enroll.
e. The Key Storage Provider window appears. Click Next.
f. Select the type of protection you want to use, and click Next.
g. If OCS is selected, select the OCS from the Card sets pane, and click Finish.
Note: If passphrase authentication is enabled, a prompt for passphrase appears.
7. Verify that the certificate is enrolled successfully.

The enrollment wizard shows if the certificate enrollment was successful or failed. Use the
Details button to check the main information.

Microsoft AD CS and OCSP Integration Guide 14


Chapter 2: Procedures

Setting up key use counting

Key use counter overview


Setting up key use counting is optional. If you require key use counting, follow the procedures
described in this section. The procedures described in this section do not apply to most setups.

Note: If you do not follow the procedures described in this section, key use counting is not
installed. You cannot add key use counting to a key retrospectively.

The key use counter audits usage of the CA signing key. It maintains a count of how many times
the key has been used. The key use counter should only be used with a root CA that has a low
volume of signings where the count can be logged immediately before servicing a signature
request and after the signature request has been serviced. This ensures that any illicit use of the
CA is revealed through discrepancies in the counter log.

Note: Note the following information about the key use counter:

l The counter is in the NVRAM of the HSM. To access the key count value in NVRAM, users
must present the ACS to the HSM.
l The counter is a 64-bit integer counter associated with a single private key.
l The counter is started at zero.
l If the maximum count is reached, the counter restarts at zero.
l The counter can exist only on one HSM. If more than one HSM is attached to the server, you
must choose which HSM stores the counter.
l If the module firmware is upgraded, the counter value is lost.
l The key counter can only be set at HSM initialization, it cannot be activated after
deployment.

Installing Certificate Services with key use counting


To install Certificate Services with key use counting:

1. If it is not already on your system installation, create the file %SystemRoot%\capolicy.inf


(where %SystemRoot% is the system environment variable for the Windows installation
folder, by default C:\WINDOWS\capolicy.inf) with the following content:

[Version]
Signature="$Windows NT$"
[certsrv_server]
EnableKeyCounting=True

Note: You must create the capolicy.inf file before Certificate Services is installed.
2. Install the CA using the HSM KSP.
3. Enable auditing for the CA service by running the command:

>certutil -setreg ca\auditfilter 1

4. Right-click the CA and click Properties.

Microsoft AD CS and OCSP Integration Guide 15


CA Backup, migrate and restore

5. Click the Auditing tab and check the box for Start and Stop Active Directory Certificate
Services.
6. Select Start > Administrative Tools > Local Security Policy.
7. Go to Local Policy, expand it and select Audit Policy.
8. In the right pane, double-click Audit Object Access and select Success and Failure.
9. Click Apply and then OK, then close the window.
10. Update the local security policies by opening a command prompt and running the command:

>gpupdate.exe /force

11. Restart the CA service to pick up the changes, by running the commands:

>net stop certsvc


>net start certsvc

12. Run Eventvwr.exe.


13. Select Windows Logs > Security.
14. Filter for event ID 4881 (CA startup event) or event ID 4880.
15. Verify the CA startup event shows the PrivateKeyUsageCount property with a
corresponding value. Make a note of this value.
16. Restart the Certificate Server, by running the commands:

>net stop certsvc


>net start certsvc

17. Verify that the event viewer contains a new CA startup event (event ID 4881).
18. Verify that the PrivateKeyUsageCount property value has not changed.

CA Backup, migrate and restore


The most common procedure related to backup, migrate and restore for the CA and HSM is to use
the options:

l Select a certificate and use its associated private key.


l Select an existing private key.

This procedure describes backing up the CA / HSM data on an existing server and then restoring
the CA / HSM data onto a new server. Thales have successfully tested this procedure in the
following configurations:

l Windows Server 2008 SP2 Enterprise 64-bit (CNG) to Windows Server 2012 Datacenter
(CNG)
l Windows Server 2008 SP2 Enterprise 64-bit (CNG) to Windows Server 2012 Standard (CNG)
l Windows Server 2008 R2 SP1 Enterprise 64-bit (CNG) to Windows Server 2012 Datacenter
(CNG)
l Windows Server 2008 R2 SP1 Enterprise 64-bit (CNG) to Windows Server 2012 Standard
(CNG)

Microsoft AD CS and OCSP Integration Guide 16


Chapter 2: Procedures

Backing up, migrating and restoring CA using an existing cer-


tificate and its associated private key

Note: For this procedure your CA must be protected with module-only protection or 1/N OCS
without passphrase as key protection method.

To back up the CA and HSM data on the existing server (machine #1), and then migrate the CA
and HSM onto a new server (machine #2):

On machine #1:

1. Back up the CA database by running the command:

>certutil -config <CA_config_string> -backupdb <BackupDirectory>

2. Export the certificate on machine #1:


a. Run mmc.
b. In the console, go to File > Add/Remove Snap-in.
c. Select the Certificates tab and click Add.
d. The certificate snap-in window opens. Select Computer Account and click Next.
e. Keep the default selection and click Finish, then click OK.
f. Go to the directory Trusted Root Certificates > Certificates.
g. Right-click the CA certificate, and click All Tasks->Export, then click Next.
h. Select Base-64 encoded X.509 (.CER), and click Next.
i. Specify the path and file name to save the certificate, and click Next.
j. Click Finish.
k. Click OK to close the export success message.
3. Back up the contents of the security world data from the following location:
C:\ProgramData\nCipher\KeyManagement Data\local.
4. Uninstall the CA from machine #1.

On machine #2:

1. Copy the backed-up security world data on the following path on machine #2:
C:\ProgramData\nCipher\KeyManagement Data\local.
2. Load the security world onto the HSM on machine #2, by running the command:

>new-world -l

For more information about loading a security world, refer to the User Guide for the HSM.
3. Run the CNG Configuration Wizard.
Note: If selecting operator card set protection, do not check Always use the wizard
when creating or importing keys.
4. Copy and install the X.509 certificate into the local user Trusted Root CA Store on machine
#2:
a. Right-click the certificate, and click Install.
b. Click Next.
c. Select Place all certificates in the following store, and click Browse.
d. Select Trusted Root Certification Authorities, and click OK.
e. Click Next.

Microsoft AD CS and OCSP Integration Guide 17


Backing up, migrating and restoring CA using an existing certificate and its associated private key

f. Click Finish.
g. Click OK to close the import success message.
5. Install the certificate into my store, by running the following command from the console:

>certutil -addstore my <certificate name>

A success message appears.


6. Repair the certificate store by running the following command from the console:

>certutil -f -repairstore -csp "nCipher Security World Key Storage Provide


r" my "<cert serial number>"

7. Click Start > Server Manager to open Server Manager.


8. Install and configure the CA as described in the section Installing and configuring AD CS on
page 8.
9. Install and configure AD CS with the following settings:
a. In the Set Up Private Key window, select Use existing private key and then Select
a certificate and use its associated private key.
b. In the existing Certificate window, the imported certificate is shown. Select the
certificate and select Allow administrator interaction when the private key is
accessed by the CA. Click Next.
c. If your CA is protected with OCS protection with passphrase, then the certificate is not
displayed in the certificate section. You must remove the passphrase of the operator
cardset in order to view the CA certificate in the certificate section.
d. In the Certificate Database window click Next.
e. In the Confirmation window click Configure.
10. When the CA installation is complete, click Close in the installation results window.
11. Copy the backed-up CA database data onto machine #2.
12. Run the command:

>certutil -shutdown

13. On machine #2, restore the CA database by running the command:

>Certutil.exe -f -restoredb <BackupDirectory>

14. Restart the CA by running the command:

>net start certsvc

15. Verify that the CA service has started successfully by running the command:

>sc query certsvc

Microsoft AD CS and OCSP Integration Guide 18


Chapter 2: Procedures

Backing up, migrating and restoring the CA using an existing


private key
To back up the CA and HSM data on the original server (machine #1), and then migrate the
CA/HSM on a new server (machine #2):

On machine #1:

1. Back up the CA database by running the command:

>certutil -config <CA_config_string> -backupdb <BackupDirectory>

2. Back up the security world data and the private key, which are found in
C:\ProgramData\nCipher\Key Management Data\local. For more information about
backing up a security world, refer to the User Guide for the HSM.
3. Uninstall the CA from machine #1.

On machine #2:

1. Copy the backed-up security world data and the private key to
C:\ProgramData\nCipher\Key Management Data\local on machine #2.
2. Load the security world onto the HSM on machine #2, by running the command:

>new-world -l

For more information about loading a security world, refer to the User Guide for the HSM.
3. Run the CNG Configuration Wizard and select Use existing security world.
4. Install Microsoft Active Directory Certificate Services with the following settings:
a. In the Private Key window, select Use existing private key and use existing
private key on this computer. Click Next.
b. In the Select Existing Key window, click Change. The Change Cryptographic
Provider window opens.
c. Select the CSP that contains the created key. Delete the contents of the field CA
common name, and click Search. The search results should find the existing private
key
d. Select the key that you generated on machine #1, click Allow administrator
interaction when the private key is accessed by the CA, and click Next.
e. On the Cryptography for CA window, click Next.
f. In the CA name window, click Next.
g. In the Validity Period window, specify the validity period and click Next.
h. In the Certificate Database window, specify the certificate database location and click
Next.
i. On the Confirmation window, click Configure.
j. In the Installation Results window, click Close.
5. Copy the backed-up CA database data onto machine #2.
6. Run the command:

>certutil -shutdown

Microsoft AD CS and OCSP Integration Guide 19


Installing the OCSP

7. On machine #2, restore the CA database by running the command:

>Certutil.exe —f —restoredb <BackupDirectory>

8. Restart the CA by running the command:

>net start certsvc

9. Verify that the CA service has started successfully by running the command:

>sc query certsvc

Installing the OCSP


Note: If you are installing OCSP on a different server from the CA, see Installing the software
and creating or sharing the security world on page 7 for instructions on sharing the
Security World.

To install Online Responder Services:

1. Open Server Manager. Select Start > Server Manager.


2. Click Manage and then click Add Roles & Features.
3. Before you begin window appears. Click Next.
4. On the Select installation type window, ensure the default selection of Role or Feature
Based Installation is selected. Click Next.
5. On Server selection, select a server from the server pool and click Next.
6. On the Select server roles window, select the Active Directory Certificate Services
role.
7. Expand the Roles section (in the left-hand section) and click Online Responder.
8. Click Add Feature, then click Next.
9. On Select Feature window click Next.
10. On Web Server Role Screen click Next.
11. On Role Service Screen keep the default selection and click Next, then click Install.
12. When the installation completes, click the Configure Online Responder link. Click Next.
The Progress window is displayed during the configuration processing.
The Results window appears.
13. Click Close. If the Installation progress window is still open, click Close on that window also.

Microsoft AD CS and OCSP Integration Guide 20


Chapter 2: Procedures

Configuring the CA to issue an OCSP Response


Signing Certificate
This section describes how to update the OCSP certificate template for use with the key storage
provider CNG. This procedure assumes you have an Enterprise CA installed.

Configuring certificate templates for your environment


1. Go to Start > Run.
2. In the run dialog type mmc and click OK.
3. In the mmc console that appears go to File > Add/Remove Snap-in
4. In the Add or Remove Snap-Ins dialog box that appears find and click the Certificate
Templates snap-in.
5. Click Add and then click OK.
6. Under Console Root expand Certificate Templates snap-in. All the available certificate
templates that you can issue with your CA are listed in the middle section.
7. Scroll down the list until you locate the OCSP Response Signing template. Right-click the
OCSP Response Signing template and click Properties.
8. In the popup dialog that appears click the Security tab and click Add.
9. In the Select User, Computers, or Groups dialog that appears type the name of the
machine that is hosting the Online Responder service. Click OK.
The machine is not immediately located. Another dialog appears.
10. In this dialog click Object Types and make sure the check box next to Computers is
checked. Click OK.
11. Re-enter machine name in the Select User, Computers, or Groups dialog if it is not
already there. Click OK.
The machine hosting the Online Responder is added to the Group and user names area under
the Security tab.
12. Click the machine name in the Group and user names area and under the Permissions
area give all permissions to machine and click Apply and then OK.
13. Click Request Handling tab and make sure that both Authorize additional service
accounts to access the private key and Allow private key to be exported are
disabled.
14. Click the Cryptography tab. Select the algorithm, hash and key size you want to use from
the Algorithm Name drop-down combo box. We recommend that you choose the same
algorithm as your CA is using, although you can use any.
15. Below the combo box are two radio buttons: select Requests must use one of the
following providers.
16. Check the box that opens next to the nCipher Security World Key Storage Provider
entry. Click Apply, then OK.
17. Select the Subject Name tab.
The radio button Build this from Active Directory Information is selected. The following
options are displayed:
l E-mail

l DNS name

l User principal name (UPN)

l Service principal name (SPN)

Make sure that only Service Principal Name (SPN) is checked.


18. Uncheck any other checked boxes. Click Apply and then OK.

Microsoft AD CS and OCSP Integration Guide 21


Configuring the CA to support the Online Responder service

Note: To use CAPI CSP, make a copy of an OCSP response signing template. From the
Cryptographic tab, under the provider category, select Legacy Cryptographic
Service Provider. Then, select Request must use one of the following
providers and check nCipher Enhanced Cryptographic Provider.

Configuring the CA to support the Online Responder service


1. Run certsrv.msc.
2. Navigate to the Action menu and click Properties.
3. Select Extensions tab. In the Select extension list, click Authority Information Access
(AIA).
4. Click Add and in the Add Location dialog box type under Location
http://machinename/ocsp. Click OK.
5. On the Extensions tab make sure that the URL that was just added to the locations area is
highlighted. Then make sure the check boxes next to Include in the AIA extension of
issued certificates and Include in the online certificate status protocol (OCSP)
extension are ticked.
6. Click Apply, let the service restart, then click OK.
7. In Certification Authority, right-click Certificate Templates, and then click New
Certificate Templates to Issue.
8. In Enable Certificates Templates, select the OCSP Response Signing template and any
other certificate templates that you configured previously, and then click OK.
9. Open Certificate Templates in the Certification Authority and verify that the modified
certificate templates appear in the list.

Requesting a certificate from OCSP Response Signing template


1. Go to Run, and type cmd to open the command prompt. Run the command:

> certutil -pulse

2. Go to Run, type mmc and click OK.


3. In the mmc console that appears, select File > Add/Remove Snap-in.
4. In the Add or Remove Snap-Ins pop-up dialog that appears, find the Certificates snap-in
(under the Available snap-ins section).
5. Click the snap-in and click Add.
6. In the dialog that appears, check the Computer Account radio button, and then click Next.
7. In the Select Computer dialog, ensure that Local Computer is selected and click Finish.
Then click OK.
8. Under the Console Root, expand the Certificates heading.
9. Select the Personal folder and expand it.
10. Right-click Certificates and select All Tasks > Request New Certificate.
11. On the Before You Begin page click Next.
12. On the Select Certificate Enrollment Policy page click Next.
13. On the Request Certificates page select OCSP Response Signing template and click
Enroll.
14. On the Certificate Installation Results page select Finish.

Microsoft AD CS and OCSP Integration Guide 22


Chapter 2: Procedures

Verifying that the signing certificate is properly configured


1. Select the Personal folder and expand it.
2. Select the Certificates folder. In the right-hand pane, an OCSP certificate appears.
3. Right-click the certificate and click Properties.
4. A dialog box appears. On the General tab under Certificate Purposes select Enable Only
for the following purposes. Click Apply and then OK.

Modifying the Online Responder service to use an Thales HSM


1. Run Services.msc.
2. Locate the Online Responder Service in the list of services.
3. Right-click the Online Responder Service and select Properties.
4. In the dialog box that appears select the Log on tab.
5. Under the Log on as heading, click the radio button next to Local System account. The
heading Allow service to interact with desktop becomes active with a check box next to
it.
6. Select the check box. Click Apply, then OK.
7. From the Services window, right-click Online Responder Service and restart the service.

Setting up a revocation configuration


A revocation configuration is needed to respond to status requests about certificates that have
been issued by a specific CA. Revocation configuration settings include:

l The CA certificate
l The signing certificate for the online responder
l The locations that clients can send their requests to

To set up a revocation configuration:

1. Click Start and click Online Responder Management.


2. In the left-hand pane click Revocation Configuration.
3. In the right-hand pane under Actions click Add Revocation Configuration.
4. Click Next on the Getting started with adding a revocation configuration section.
5. In the Name the Revocation Configuration section, type a name for the configuration in
the text box. (For this example we use Test). Then click Next.
6. In the Select CA Certificate Location section ensure that the Select a certificate for an
Existing enterprise CA radio button is checked and click Next.
7. In the Choose CA Certificate section ensure that the Browse CA certificates published
in Active Directory radio button is selected and then click Browse.
8. In the Select Certification Authority dialog box select the CA and click OK then Next.
9. In the Select Signing Certificate section ignore the default settings and make sure the
Manually select a signing certificate radio button is selected. Click Next.
10. If you are installing OCSP on a different server to the CA:
a. On the Revocation Provider section click on Provider tab. The Revocation Provider
Properties dialog is displayed.
b. Under Base CRLs, click Add.
c. Enter http://<OCSP hostname>/ocsp/<CA-name>.crl in the Open URL dialog box and
click OK.
d. Under Base CRLs, select the above URL, click Move Up and then click OK.

Microsoft AD CS and OCSP Integration Guide 23


Verifying that OCSP works correctly

e. Copy the CRL files from the c:\Windows\System32\certsrv\CertEnroll folder of the


CA server to the C:\Windows\SystemData\ocsp folder of the OCSP server.
11. In the next window click Finish. A dialog box opens stating Executing the specified
action.... Let this finish.
12. When the wizard completes, the status of the Online Responder is shown in the Revocation
Configuration Status box as Bad Signing Certificate on Array Controller.
13. To fix this, click Array Configuration in the left-hand pane and expand it.
14. In the directory tree, click the machine name that you are using.
15. The revocation configuration that you just created is listed in the middle section, in this case
Test.
16. In the right-hand pane, click Assign a signing certificate.
17. Click the certificate that you set up earlier and is listed in the dialog box that opens. Click OK.
18. Go back to the Revocation Configuration pane and right-click the revocation configuration
you created (in this case Test) and then click Edit Properties.
19. A Properties for Revocation Configuration: Test pane opens. Three tabs are available.
Click the Signing tab.
20. Uncheck the Do not prompt for credentials for cryptographic operations check box
and click OK.
21. Go back to Online Responder Management, go to Actions and click Refresh.
22. In the left-hand pane click Online Responder: Computer Name and check that the
Revocation Configuration Status shows as Working.

Verifying that OCSP works correctly

Generating a certificate request


1. Open Notepad and create a file called rsa.inf with contents similar to the following on your
local C drive:

[Version]
Signature = "$Windows NT$"
[NewRequest]
KeyUsage = 0xf0
MachineKeySet = True
RequestType = PKCS10
[EnhancedKeyUsageExtension]
OID = 1.3.6.1.5.5.7.3.1
[Extensions]
1.3.6.1.5.5.7.48.1.5 = Empty

In the rsa.inf file replace the subject with your CA common name.
2. Go to your local directory and find the file rsa.inf.
3. Check that rsa.inf contains the following messages:

Leaf certificate revocation check passed


CertUtil: -verify command completed successfully.

4. From the command prompt navigate to your local C drive and add:

>Certreq —new rsa.inf rsa.req

Microsoft AD CS and OCSP Integration Guide 24


Chapter 2: Procedures

5. Check that rsa.req is listed in the directory.


6. In the command line run the command:

>certreq —submit —attrib —CertificateTemplate:WebServer rsa.req

7. Click OK to select the CA certificate and save it as rsa.cer in your local directory.
8. Navigate to the directory where you saved the certificate and look for rsa.cer.

Removing information about the certificate's CRL


1. Select Start > Run, and enter certsrv.msc. Click OK.
2. Click Certificate Authority. A list of folders below the CA appears.
3. Right-click the Revoked Certificates folder and click All Tasks, Publish. A Publish CRL
dialog appears.
4. Click OK to select a New CRL.
5. Right-click the CA and select Properties.
6. Click the Extensions tab.
7. Check that the Select extension drop-down list box shows CRL Distribution Point (CDP).
8. Click any of the listed CRL distribution points, and click Remove, then Yes.
9. Click Apply. A pop-up box appears saying you need to restart the service.
10. Click Yes to restart the service, and then click OK to close the dialog.

Retrieving information about the certificate's AIA, CRLs, and


OCSP
1. To check that clients can still obtain revocation data in the command prompt, navigate to the
folder where the certificate is stored, then type:

>Certutil —url rsa.cer

2. The URL Retrieval Tool appears.


3. Select Certs (from AIA) and click Retrieve.
4. The list contains the verified Certificate and its URL. Select CRLs (from CDP) and click
Retrieve.
5. Compare the results to what you had earlier when you removed a CRL distributed point. CRLs
show they have been verified.
6. Select OCSP (from AIA) and click Retrieve.
7. The list contains the Verified OCSP URL. Click Exit.

Microsoft AD CS and OCSP Integration Guide 25


Verifying the OCSP Server is Active

Verifying the OCSP Server is Active


1. To check details about the certificate and its CA configuration in the command prompt,
navigate to the folder wher the certificate is stored, then type:

>Certutil -verify rsa.cer > rsa.txt

2. Open the text file rsa.txt. The last few lines should be as follows:

Verified Issuance Policies: None


Verified Application Policies:
1.3.6.1.5.5.7.3.1 Server Authentication
Leaf certificate revocation check passed
CertUtil: -verify command completed successfully

3. This shows that the OCSP Server is working correctly and there were no errors.

Uninstalling AD CS and OCSP


To uninstall AD CS and OCSP:

1. Open Server Manager and click Start > Server Manager.


2. Click Manage and then click Remove Roles & Features.
The Before you begin window opens. Click Next.
3. On server selection, select a server from the server pool, and click Next.
4. Deselect Active Directory Certificate Services and Online Responder, and click Next.
5. When the Removal process is complete, click Close and restart the machine.

Microsoft AD CS and OCSP Integration Guide 26


Chapter 3: Troubleshooting

Chapter 3: Troubleshooting
The following table provides troubleshooting guidelines.

Problem Cause Resolution


This error occurs when
Online Responder Ensure that the steps above have been
the CA certificate is
reports Bad Signing correctly carried out. Also, ensure that the
stale or cannot be
Certificate on CA is correctly configured and that a valid
located by the Online
Array Controller. CA certificate exists for OCSP Signing.
Responder client.
Using Install Certificate Authority Web Enrolment
certutil —url on the CA machine. Go to Server
<certnamehere.cer> This error occurs when Manager. Expand the Roles section (in the
and selecting Certs Certificate Authority left-hand section) and click Active
(from AIA) shows an Web Enrolment is not Directory Certificate Services. In the
entry in the list called installed on the CA. bottom right-hand section, click Add Role
AIA with Failed next Services and select Certificate
to it. Authority Web Enrolment.
Using the certreq —
This error occurs when Ensure that the Thales CAPI CSP and Thales
new <.req file
the CSPs are not CNG CSP providers are correctly installed
here> command
installed and set up on and set. (Do this by running the CSP
returns an Invalid
the client machine or Install Wizard and CNG Configuration
Provider Specified
not set up correctly. Wizard under nCipher in the Start menu).
error.

Microsoft AD CS and OCSP Integration Guide 27


Addresses

Addresses
Americas

900 South Pine Island Road, Suite 710, Plantation, Florida 33324, USA

Tel: +1 888 744 4976 or + 1 954 888 6200

sales@thalesesec.com

Europe, Middle East, Africa

Meadow View House, Long Crendon, Aylesbury, Buckinghamshire HP18 9EQ, UK

Tel: + 44 (0)1844 201800

emea.sales@thales-esecurity.com

Asia Pacific

Units 4101, 41/F. 248 Queen’s Road East, Wanchai, Hong Kong, PRC

Tel: + 852 2815 8633

asia.sales@thales-esecurity.com

Internet addresses

Web site: http://www.thales-esecurity.com/


Support: http://www.thales-esecurity.com/support-landing-page
Online documentation: http://www.thales-esecurity.com/knowledge-base
International sales offices: http://www.thales-esecurity.com/contact

Microsoft AD CS and OCSP Integration Guide 28