Key management
HashiCorp Vault Managed Keys

Test PKI operations

7min

This section shows how to initialize the vault and then test the PKI operations.

Initialize Vault

Before performing PKI operations, you must initialize, unseal (if required), and log in to Vault.

1

In a different terminal window from where Vault is running, set the VAULT_ADDR and PIN environment variables.

Shell


Set the PIN value to the identity password configured inside the <CRYPTO-OPR-PASS> tag in the fxpkcs11.cfg file.

2

Check the Vault status.

Shell


The output should look similar to the following example:

Text

3

Initialize Vault.

We do not recommend using 1 for both the key shares and the key threshold in production.

Shell


The output should look similar to the following example:

Text

4

If you did not configure HSM auto unseal, you must unseal Vault manually:

Shell

5

Log in to Vault.

Shell


Generate managed keys on the for the Root and Intermediate CA

1

Generate a managed key on the for the Root CA.

Shell


You must always set the value specified in the token_label field to Futurex.

The value specified in the library field must match the value set in the name field of the kms_library stanza in the following Vault configuration file.

Text

2

Generate a managed key on the for the Intermediate CA.

Shell

3

Verify that the key configuration has been written to Vault.

Shell

4

Verify that the key configurations are valid by test signing some data.

Shell


Enable the PKI secrets engine for the Root and Intermediate CA

1

Enable the PKI secrets engine for the Root CA.

Shell

2

Enable the PKI secrets engine for the Intermediate CA.

Shell


Create a Root CA certificate from the managed key generated on the 

1

Create a Root CA certificate with its corresponding managed key and output it to a file.

Shell

2

Verify the certificate looks correct.

Shell


Create a Certificate Signing Request (CSR) for the Intermediate CA from the managed key generated on the 

1

Create a CSR for the Intermediate CA with its corresponding managed key and output it to a file.

The following command requires installing the jq package, which processes JSON output, on your system.

Shell

2

Verify the CSR looks correct.

Shell


Use the managed Root CA to issue the Intermediate CA certificate from a CSR

1

Issue the Intermediate CA certificate from the CSR by using the managed Root CA and output it to a file.

The following command requires installing the jq package, which processes JSON output, on your system.

Shell

2

Write the signed Intermediate CA certificate to Vault.

Shell


Issue a leaf certificate from the managed Intermediate CA

1

Create a new role.

Shell

2

Issue a leaf certificate.

Shell