Initialize and Authorize HMAC and MKEK for CP5

A key can not be used without being authorized in CryptoServer CP5. To authorize a key, you must first initialize it with and authorization key and then set the authorization with the AuthorizeKey command.

  1. List existing keys using cxitool ListKeys.

›_ Console

# ./cxitool Dev=3001@localhost LogonPass=<CryptoUser>,<CryptoUser_PIN>  Group=<group_name> ListKeys


CXI_ListKeys.png


Listing keys with cxitool

  1. Check the status of key initialization using cxitool KeyInfo.

›_ Console

# ./cxitool dev=3001@127.0.0.1 LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=1 KeyInfo

# ./cxitool dev=3001@127.0.0.1 LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=2 KeyInfo

We can see that the key’s ‘Initialized’ status is ‘False’.

MKEK_KeyInfo_Marked.png


MKEK key info before initialization

HMAC_KeyInfo_Marked.png


HMAC key info before initialization

  1. Run below command to generate user authentication key file KA.key, which contains an RSA key pair of given size. This authentication key will be used to initialize the MKEK and HMAC in the next steps.

›_ Console

# ./csadm GenKey=keys/KA.key,2048,"USR_0001"

  1. Initialize the MKEK and HMAC with authentication file KA.key.

›_ Console

# ./cxitool Dev=3001@localhost LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=1 Keyfile=keys/KA.key InitializeKey

# ./cxitool Dev=3001@localhost LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=2 Keyfile=keys/KA.key InitializeKey


InitializeKey.png


Initialize MKEK and HMAC

  1. Check the status of key initialization again using cxitool KeyInfo.

›_ Console

# ./cxitool dev=3001@127.0.0.1 LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=1 KeyInfo

# ./cxitool dev=3001@127.0.0.1 LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=2 KeyInfo


InitializedMKEK_Marked.png


MKEK key info after initialization


InitializedHMAC_Marked.png


HMAC key info after initialization

  1. Authorize the MKEK and HMAC with authentication file KA.key.

›_ Console

# ./cxitool Dev=3001@localhost LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=1 Keyfile=keys/KA.key AuthorizeKey

# ./cxitool Dev=3001@localhost LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=2 Keyfile=keys/KA.key AuthorizeKey


AuthorizeKey.png


Authorize MKEK and HMAC

Keys need to be authorized before being used for encryption, decryption, signing, verifying and computing hashes. The command can be executed with or without <authcounter> parameter (e.g. AuthorizeKey=10 or AuthorizeKey). The parameter defines the number of operations the cryptographic key can be used for. If the key is used for an operation, the counter is decremented by 1. When it reaches 0, it cannot be used anymore until the AuthorizeKey command is executed again. If we run the command without the parameter, an unlimited number of key operations is supported until a server restart or revoking the authorization.

  1. Confirm the keys were authorized by using cxitool KeyInfo and checking the value under Remaining Ops.

›_ Console

# ./cxitool dev=3001@127.0.0.1 LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=1 KeyInfo

# ./cxitool dev=3001@127.0.0.1 LogonPass=<CryptoUser>,<CryptoUser_PIN> Group=<group_name> Spec=2 KeyInfo


AuthorizedMKEK_KeyInfo_Marked.png


Authorized MKEK

AuthorizedHMAC_KeyInfo_Marked.png


Authorized HMAC

The keys are now initialized and authorized and can be used by OpenStack Barbican.