HSM Installation and Configuration For Safenet
HSM Installation and Configuration For Safenet
Version 8.19
DigiCert, Inc.
2801 North Thanksgiving Way, Suite 500
Lehi, UT 84043
https://www.digicert.com/
pg. 2
HSM Installation and Configuration for SafeNet
Table of Contents
INTRODUCTION ........................................................................................................................... 5
pg. 3
HSM Installation and Configuration for SafeNet
pg. 4
HSM Installation and Configuration for SafeNet
Introduction
This document describes the installation and configuration steps for SafeNet Network HSM
to be used by the DigiCert PKI Enterprise Gateway and Autoenrollment server.
Revision History
No. Date Summary
pg. 5
HSM Installation and Configuration for SafeNet
pg. 6
HSM Installation and Configuration for SafeNet
Supported HSMs
HSM Type Client Version Software Version Firmware Version
*a : Both Export and Signing variants were qualified with the supported HSM types.
*b : SafeNet Network HSM 7 Luna PCI, and Luna G5 are functionally identical and the above
qualified versions of SafeNet Network HSM 7 should work with Luna PCI and Luna G5.
*c : If the listed Luna Client and Software versions are deployed, the Luna SA 6 HSM should
also work, although not formally qualified by DigiCert.
*d : SafeNet Network HSM 7 supports FIPS and non-FIPS Mode, Cloning and Export Mode.
pg. 7
HSM Installation and Configuration for SafeNet
pg. 8
HSM Installation and Configuration for SafeNet
pg. 9
HSM Installation and Configuration for SafeNet
pg. 10
HSM Installation and Configuration for SafeNet
Once the Installation is completed, the UNINSTALL and MODIFY button will get
displayed. Click QUIT.
pg. 11
HSM Installation and Configuration for SafeNet
lunacm:> clientconfig v
If you do not want to follow the one step setup (Step 2), follow the below steps:
a) Obtain the Server Certificate.
The Server Certificate has been created on the HSM, so we need to copy it from the
server.
pg. 12
HSM Installation and Configuration for SafeNet
New group with label "HAGroup" created with group number <SERIALNUMBER>.
Group configuration is:
pg. 13
HSM Installation and Configuration for SafeNet
Available HSMs:
Slot Id -> 1
Label -> <PARTITION-NAME>
Serial Number -> 1336489553517
Model -> LunaSA 7.2.0
Firmware Version -> 7.0.3
Configuration -> Luna User Partition With SO (PED) Signing With Cloning Mode
Slot Description -> Net Token Slot
FM HW Status -> FM Ready
Slot Id -> 5
HSM Label -> <HA-LABEL>
HSM Serial Number -> 11336489553517
HSM Model -> LunaVirtual
HSM Firmware Version -> 7.0.3
HSM Configuration -> Luna Virtual HSM (PED) Signing With Cloning Mode
HSM Status -> N/A - HA Group
NOTE: Both “Configure CSP” and “Configure KSP” must be configured again if you run the
steps above.
lunacm:> hagroup ho -e
"HA Only" has been enabled.
Command Result : No Error
lunacm:> hagroup ho -s
This system is configured to show only HA slots. (HA Only is
enabled)
pg. 14
HSM Installation and Configuration for SafeNet
Configure CSP
NOTE: Please note that for the deployment of the Autoenrollment Server, you need to
configure CSP.
For SafeNet CSP, the utility register.exe (64-bit version) takes care of the registry. To
configure CSP, open a command prompt and run the following commands.
Register CSP Library
C:\Program Files\SafeNet\LunaClient\CSP>register.exe
***************************************************************************
* *
* Safenet LunaCSP, Partition Registration *
* *
* Protect the HSM's challenge for the selected partitions. *
* *
* NOTE: *
* This is a WEAK protection of the challenge. *
* After you have configured all applications that will use *
* the LunaCSP and ran them once, you MUST run: *
* register /partition /strongprotect *
* to strongly protect the registered challenges. *
* *
***************************************************************************
pg. 15
HSM Installation and Configuration for SafeNet
c:\Program Files\SafeNet\LunaClient\CSP>register.exe /h
register.exe (64-bit) v10.1.0-32. Copyright (c) 2019 SafeNet. All rights
reserved.
***************************************************************************
* *
* Safenet LunaCSP, Partition Registration *
* *
* Protect the HSM's challenge for the selected partitions. *
* *
* NOTE: *
* This is a WEAK protection of the challenge. *
* After you have configured all applications that will use *
* the LunaCSP and ran them once, you MUST run: *
* register /partition /strongprotect *
* to strongly protect the registered challenges. *
* *
***************************************************************************
Configure KSP
NOTE: Please note that for the deployment of the Enterprise Gateway Server, you need to
Configure KSP.
pg. 16
HSM Installation and Configuration for SafeNet
Follow instructions for the use of the graphical KspConfig.exe as described in KSP for CNG
in the SDK Reference Guide.
The following window will appear.
Double-click Register Or View Security Library, and then confirm the value "C:\Program
Files\SafeNet\LunaClient\cryptoki.dll".
pg. 17
HSM Installation and Configuration for SafeNet
• Select Administrator
• Select SYSTEM
• Select NT AUTHORITY
pg. 18
HSM Installation and Configuration for SafeNet
NOTE: When you click "Register Slot", there is no change on "Registered Slot", but this step is
necessary.
When registering the Luna KSP (with the Luna KSPConfig utility), use the following user and
domain combinations:
• The user and domain running the web application and using the private key.
NOTE: If you implement the Autoenrollment server, you must also install and register the
Luna CSP. Refer to the SafeNet product documentation for details.
pg. 19
HSM Installation and Configuration for SafeNet
[NewRequest]
KeyUsageProperty = "NCRYPT_ALLOW_ALL_USAGES"
RequestType = PKCS10
ProviderName = "Luna Cryptographic Services for Microsoft Windows"
ProviderType = 1
Subject = "CN=Registration Authority"
KeyContainer = "CSPRA20190418"
MachineKeySet = TRUE
HashAlgorithm = SHA256
KeyAlgorithm = RSA
KeyLength = 2048
[NewRequest]
KeyUsageProperty = "NCRYPT_ALLOW_ALL_USAGES"
RequestType = PKCS10
ProviderName = "SafeNet Key Storage Provider"
ProviderType = 0
Subject = "CN=Registration Authority"
KeyContainer = KSPRAID20190418
MachineKeySet = TRUE
HashAlgorithm = SHA256
KeyAlgorithm = RSA
KeyLength = 2048
KeyUsage = 0xf0
NOTE: <inf-file> is the file created at step #1, <csr-file> is an output file.
pg. 20
HSM Installation and Configuration for SafeNet
Install a certificate.
a) Open command prompt (on the folder where the PKCS#7 file exists) and run the
following command.
b) Before running the command, the trusted root certificate must be installed. If not,
the following error will be displayed.
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.8=sun.security.smartcardio.SunPCSC
security.provider.9=com.safenetinc.luna.provider.LunaProvider
pg. 21
HSM Installation and Configuration for SafeNet
NOTE: We recommend setting the PATH variable in Windows environments using the
System Environments menu.
Install RA Certificate
Refer section "Using an RA Certificate on HSM" of DigiCert® PKI Enterprise Gateway
Deployment Guide document.
Before proceeding, we should understand the 3 types of users in the DPoD role hierarchy
which are as follows:
pg. 22
HSM Installation and Configuration for SafeNet
Install LunaClient
Add a Subscriber Group as Tenant Administrator
pg. 23
HSM Installation and Configuration for SafeNet
pg. 24
HSM Installation and Configuration for SafeNet
Click on the link of group which has been created to view the Group details.
Sign in to DPoD site using your Tenant Administrator credential. Select "Accounts" tab
and click on "Users".
pg. 25
HSM Installation and Configuration for SafeNet
Fill out the form with the User details and then click "Add User".
pg. 26
HSM Installation and Configuration for SafeNet
pg. 27
HSM Installation and Configuration for SafeNet
Fill out the form with the Administrator details then click "Add User".
pg. 28
HSM Installation and Configuration for SafeNet
pg. 29
HSM Installation and Configuration for SafeNet
HSM on Demand: Set up and access an HSM on Demand service for your organization’s
cryptographic operations.
Under the "HSM on Demand" service tile, click the toggle to enable service.
pg. 30
HSM Installation and Configuration for SafeNet
pg. 31
HSM Installation and Configuration for SafeNet
pg. 32
HSM Installation and Configuration for SafeNet
pg. 33
HSM Installation and Configuration for SafeNet
Enter "Service Client Name" and then click "Create Service Client".
pg. 34
HSM Installation and Configuration for SafeNet
Click "Download Client" to download the service client software onto your workstation.
The name of the archive file will be setup-<Service Client Name>.zip. All the tools are
included into the file.
pg. 35
HSM Installation and Configuration for SafeNet
pg. 36
HSM Installation and Configuration for SafeNet
Click on “Next”.
Click “Close”.
pg. 37
HSM Installation and Configuration for SafeNet
pg. 38
HSM Installation and Configuration for SafeNet
This will take several seconds to prepare the client for download.
pg. 39
HSM Installation and Configuration for SafeNet
NOTE: Ensure that you Install/Configure the client that is downloaded in previous step i.e.
(Step 4) and ignore the client that was downloaded earlier.
The Windows service client installation uses a .zip file to deliver the HSM on Demand
(HSMoD) service client materials required for configuring your system's connection to the
HSMoD service. The service client .zip includes a pre-configured crystoki-template.ini file
along with a client archive file containing a set of library and binary files. Complete the
following procedures to access your HSMoD service from a Windows operating system.
Extract the downloaded archive file.
Using the Windows GUI or an unzip tool, unzip the file. The extracted files are as follows:
pg. 40
HSM Installation and Configuration for SafeNet
NOTE: Extract the cvclient-min.zip within the directory you created in the previous step. Do
not extract to a new cvclient-min.zip directory. This location is required for the setenv
command in the next step.
> setenv.cmd
Generated C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\crystoki.ini
[Chrystoki2]
LibNT="C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\cryptoki.dll"
LibNT32="C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\cryptoki.dll"
[CardReader]
RemoteCommand=1
[Luna]
DefaultTimeOut=5000
PEDTimeout1=100000
PEDTimeout2=200000
PEDTimeout3=20000
KeypairGenTimeOut=2700000
CloningCommandTimeOut=300000
pg. 41
HSM Installation and Configuration for SafeNet
CommandTimeoutPedSet=720000
[Presentation]
ShowEmptySlots=no
[Misc]
PE1746Enabled=1
ToolsDir="C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\"
[XTC]
PartitionCAPath="C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\partition-ca-
certificate.pem"
PartitionCertPath00="C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\partition-
certificate.pem"
Enabled=1
TimeoutSec=10
[LunaSA Client]
SSLConfigFile="C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\openssl.cnf"
ReceiveTimeout=20
TCPKeepAlive=1
NetClient=1
ServerCAFile="C:\Users\test\CloudHSM\setup-DPPC-
CloudHSM\cert\server\CAFile.pem"
ClientCertFile="C:\Users\test\CloudHSM\setup-DPPC-
CloudHSM\cert\client\ClientNameCert.pem"
ClientPrivKeyFile="C:\Users\test\CloudHSM\setup-DPPC-
CloudHSM\cert\client\ClientNameKey.pem"
[REST]
RestClient=1
ClientTimeoutSec=120
ClientPoolSize=32
ClientEofRetryCount=15
ClientConnectRetryCount=900
ClientConnectIntervalMs=1000
CVAppSpecificData=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PartitionData00=1285325032737, na.hsm.dpondemand.io, 443
SSLClientSideVerifyFile="C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\server-
certificate.pem"
pg. 42
HSM Installation and Configuration for SafeNet
Start LunaCM.
Start LunaCM. From the directory where you unzipped the cvclient-min.zip file,
execute lunacm.exe. If the command executes with no errors, your connection is
working correctly.
>lunacm.exe
lunacm.exe (64-bit) v10.1.0-32. Copyright (c) 2019 SafeNet. All rights
reserved.
Available HSMs:
Slot Id -> 3
Label ->
Serial Number -> 1285325034359
Model -> Cryptovisor7
Firmware Version -> 7.3.0
CV Firmware Version -> 1.3.0
Configuration -> Luna User Partition With SO (PW) Signing With
Cloning Mode
Slot Description -> Net Token Slot
FM HW Status -> FM Not Supported
Current Slot Id: 3
NOTE: If you use proxy server, you need to set environment variable of https_proxy as
follows;
Configure LunaClient
Initialize the partition and users
NOTE: You can verify the slot number by executing "slot list" in lunacm.
pg. 43
HSM Installation and Configuration for SafeNet
Initialize the Crypto Officer role and set the initial password.
Run the following command to initialize the Crypto Office (CO) role - you can use the
shortcut "co":
Log out.
The Partition SO can create the Crypto Officer, but only the Crypto Officer can create the
Crypto User. You must log out to allow the Crypto Officer to login with the newly-set
password.
pg. 44
HSM Installation and Configuration for SafeNet
NOTE: Once the Crypto Officer logs in and changes the initial credential set by the Partition
SO, applications using the CO's challenge secret/password can perform cryptographic
operations in the partition. The Crypto Officer can create, modify and delete crypto objects
within the partition, and use existing crypto objects (sign/verify). You can also create a
limited-capability role called Crypto User that can use the objects created by the Crypto
Officer but cannot modify them. The separation of roles is important in some security
regimes and operational situations, and where you might be required to satisfy audit criteria
for industry or government oversight.
NOTE: The password for the Crypto Officer role is valid for the initial login only. You must
change the initial password using the command role changepw during the initial login
session, or a subsequent login. Failing to change the password will result in a
CKR\_PIN\_EXPIRED error when you perform role-dependent actions.
If you have not already done so, change the initial password set by the Partition SO.
The Crypto User can now log in with the credentials provided by the Crypto Officer and
change the initial password. The Crypto User can now use applications to perform
cryptographic operations using keys and objects created in the partition by the Crypto
Officer.
NOTE: The password for the Crypto User role is valid for the initial login only. The CU must
change the initial password using the command role changepw during the initial login
session, or a subsequent login. Failing to change the password will result in a
CKR\_PIN\_EXPIRED error when they perform role-dependent actions.
pg. 45
HSM Installation and Configuration for SafeNet
Configure CSP
For SafeNet CSP, the utility register.exe takes care of the registry. To configure CSP, open
command prompt as Administrator and run the following commands.
Register CSP Library
C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\csp>register.exe /library
register .exe (64-bit) v10.1.0-32. Copyright (c) 2019 SafeNet. All rights
reserved.
Success registering SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Luna
enhanced RSA and AES provider for Microsoft Windows !
Success registering SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Luna
Cryptographic Services for Microsoft Windows !
Success registering SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Luna
SChannel Cryptographic Services for Microsoft Windows !
pg. 46
HSM Installation and Configuration for SafeNet
C:\Users\test\CloudHSM\setup-DPPC-CloudHSM\csp>register.exe
register .exe (64-bit) v10.1.0-32. Copyright (c) 2019 SafeNet. All rights
reserved.
***************************************************************************
* *
* Safenet LunaCSP, Partition Registration *
* *
* Protect the HSM's challenge for the selected partitions. *
* NOTE: *
* This is a WEAK protection of the challenge!! *
* After you have configured all applications that will use *
* the LunaCSP, and ran them once, you MUST run: *
* register /partition /strongprotect *
* to strongly protect the registered challenges!! *
***************************************************************************
This procedure is a destructive procedure and will completely replace any
previous settings!!
Do you wish to continue?: [y/n]y
Do you want to register the partition named 'DPPC-QA'?[y/n]: y
Enter challenge for partition 'DPPC-QA' :********
Success registering the ENCRYPTED challenge for partition 'DPPC-QA:3'.
Only the LunaCSP will be able to use this data!
Registered 1 partition(s) for use by the LunaCSP!
Configure KSP
To configure KSP(CNG), run KspConfig.exe. Follow instructions for the use of the
graphical KspConfig.exe as described in KSP for CNG in the SDK Reference Guide. The
following window will appear:
pg. 47
HSM Installation and Configuration for SafeNet
Double-click Register Or View Security Library, then you can select the value is
"<extracted-directory>\cryptoki.dll".
• Select Administrator
pg. 48
HSM Installation and Configuration for SafeNet
NOTE: When you click "Register Slot", there is no change, but this step is necessary.
When registering the Luna KSP (with the Luna KSPConfig utility), use the following user
and domain combinations:
• The user and domain running the web application and using the private key.
NOTE: If you implement the Autoenrollment server, you must also install and register the
Luna CSP. Refer to the Luna product documentation for details.
pg. 49
HSM Installation and Configuration for SafeNet
[NewRequest]
KeyUsageProperty = "NCRYPT_ALLOW_ALL_USAGES"
RequestType = PKCS10
ProviderName = "Luna Cryptographic Services for Microsoft Windows"
ProviderType = 1
Subject = "CN=Registration Authority"
KeyContainer = "CSPRA20190717"
MachineKeySet = TRUE
HashAlgorithm = SHA256
KeyAlgorithm = RSA
KeyLength = 2048
To generate CSR through certreq.exe via KSP, the ProviderName must be "SafeNet Key
Storage Provider". A sample inf file is shown below:
[NewRequest]
KeyUsageProperty = "NCRYPT_ALLOW_ALL_USAGES"
RequestType = PKCS10
ProviderName = "SafeNet Key Storage Provider"
ProviderType = 0
Subject = "CN=Registration Authority"
KeyContainer = "KSPRA20190717"
MachineKeySet = TRUE
HashAlgorithm = SHA256
KeyAlgorithm = RSA
KeyLength = 2048
KeyUsage = 0xf0
pg. 50
HSM Installation and Configuration for SafeNet
NOTE: When the following error message is displayed, SafeNetKSP.dll must be copied to
c:\Windows\System32.
Certificate Request Processor: The system cannot find the file specified.
0x80070002 (WIN32: 2 ERROR_FILE_NOT_FOUND)
Get RA Certificate
See "Get RA Certificate in PKI-Manager".
Install a certificate.
Open command prompt (on the folder the PKCS#7 file exists) and run the following
command:
Before running the command, the trusted root certificate must be installed. if not, the
following error will be displayed.
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.8=sun.security.smartcardio.SunPCSC
security.provider.9=com.safenetinc.luna.provider.LunaProvider
pg. 51
HSM Installation and Configuration for SafeNet
NOTE: We recommend setting the PATH variable in Windows environments using the
System Environments menu.
Install RA Certificate
Refer section "Using an RA Certificate on HSM" of DigiCert® PKI Enterprise Gateway
Deployment Guide document
pg. 52
HSM Installation and Configuration for SafeNet
Paste your CSR and enter a certificate friendly name and then click "Continue".
pg. 53
HSM Installation and Configuration for SafeNet
pg. 54