Integrate the Entrust Timestamping Authority with the nShield HSM

Create a certificate request

  1. Run the following command in the EDM VM terminal to load the HSM configuration.

    sudo /usr/local/bin/tsactl import-nshield -f /opt/nfast/kmdata
    Importing overwrites any existing kmdata in TSA, and keys previously created in TSA are lost. Back up the existing material first and confirm that you are importing into the intended deployment.

    Review the overwrite prompt before answering. Expect confirmation that the secrets were established and that a redeploy is required.

  2. Confirm that the Security World is usable.

    [sysadmin@timestamping-auth-edm ~]$ /opt/nfast/bin/nfkminfo
    World
     generation  2
     state       0x3737000c Initialised Usable
    
    ...
    
    Module #1 Slot #0 IC 217
     generation    1
     phystype      SmartCard
     slotlistflags 0x2 SupportsAuthentication
     state         0x5 Operator
     flags         0x10000
     shareno       2
     shares        LTU(PIN) LTFIPS
     error         OK
    Cardset
     name          "testOCS"
     k-out-of-n    1/5
     flags         NotPersistent PINRecoveryForbidden(disabled) !RemoteEnabled
     timeout       none
     card names    "" "" "" "" ""
     hkltu         edb3d45a28e5a6b22b033684ce589d9e198272c2
     gentime       2023-07-20 18:50:48
  3. Create the key pair and the certificate signing request (CSR) for signing TSA responses.

    sudo env NFAST_NFKM_TOKENSFILE=/tmp/preloadtoken /opt/nfast/bin/preload -c <cardset-name> /usr/local/bin/tsactl create-key -k RSA2048 -s "CN=TSA" -o /tmp/tsa-cert-request.txt -t <cardset-name> -v nshield

    Enter the cardset passphrase at the preload prompt, and, if prompted by tsactl, the HSM PIN. Keep the OCS in slot 0 until key creation completes. Do not use -F with OCS protection.

    If /tmp/tsa-cert-request.txt already exists, tsactl requests confirmation before overwriting it. A successful run reports Secret(s) established and CSR written in path: /tmp/tsa-cert-request.txt. A redeploy is required for the new configuration to take effect.

  4. Confirm the CSR. The file is root-owned, so use sudo:

    sudo openssl req -in /tmp/tsa-cert-request.txt -noout -subject -verify

    Confirm that OpenSSL reports the subject CN=TSA and that the signature verifies.

  5. Stage a readable copy and transfer it to your CA workstation by an approved secure method:

    sudo install -o sysadmin -g edm -m 0644 /tmp/tsa-cert-request.txt /home/sysadmin/tsa-cert-request.txt

Sign the certificate request

  1. Create a timestamping certificate template in your CA to sign the tsa-cert-request.txt CSR created in Create a certificate request. Name the template EntrustTimestampingAuth. The template is based on the Web Server certificate template, with these changes:

    • Remove the Server Authentication application policy from the Extensions.

    • Add the Time Stamping application policy to the Extensions.

    • Mark the Extended Key Usage extension as critical.

    • Allow the subject to be supplied in the request.

    • Restrict Read and Enroll permissions to the accounts that submit TSA certificate requests.

      Create the template on the CA that signs the TSA certificate. For a root and subordinate CA design, create and sign the certificate on the subordinate CA.

      certificate template 1
  2. Sign the CSR with the template. The signed certificate file, tsa-signed-cert.cer in this example, must contain a certificate in PEM format and Base64 encoding.

    certreq -submit -attrib "CertificateTemplate:EntrustTimestampingAuth" tsa-cert-request.txt
  3. Save the issued certificate as tsa-signed-cert.cer.

  4. Confirm that the certificate has the Time Stamping extended key usage, marked as critical:

    certutil -dump tsa-signed-cert.cer

    Confirm that the Extended Key Usage extension lists Time Stamping and is marked critical, and that the subject is CN=TSA. Check that the file is PEM Base64 by confirming its first line is -----BEGIN CERTIFICATE-----:

    findstr /b "-----BEGIN" tsa-signed-cert.cer

Export your root CA certificate

Your certificate chain will be needed to verify the time stamp in Test the integration.

  1. Export the certificates of your CAs in the chain (root CA and any subordinate CA), as Base-64 encoded X.509 (.CER). Copy them to the workstation that will send the time stamp requests in Test the integration.

  2. Concatenate the certificates into a single PEM file, with the root CA first:

    type root-ca.cer sub-ca.cer > chain.pem

    Replace root-ca.cer and sub-ca.cer with your exported file names. Confirm that chain.pem contains one -----BEGIN CERTIFICATE----- block for each CA.