How to convert HSM message (RV) code in the Vault to PKCS#11 message code.
Objective
Instructions on how to convert HSM message code in the Vault to PKCS#11 message code. This is when the CRYPT(1) debugging has been enabled.
Environment
v7.0;v7.1;v7.2;v7.5;v7.6;v8.0;v8.0 Beta;8.1;v8.2;v8.5;v8.6;v9.0;v9.1;v9.2;9.3;9.5;9.6;9.7;9.8;9.9;9.9.5;9.10;10.0;10.1;10.2;10.3;10.4;10.5;10.6;10.7;10.8;v9.97;v9.8.3;v9.8.1;v9.7.5;v10.3.1;v10.3.2;10.9;10.10;11.1;11;11.2;11.3;11.4;11.5;11.6;11.7
Procedure
HSM debug level CRYPT(1) should be enabled.
Vault HSM error codes are in decimal and the standard is to display them in Hex.
So when you receive an HSM error like:
===
CAVLT138E Cannot find suitable slot to store Server Key (Code: 1103, 160)
===
The “160” is the decimal value. You can use the windows calculator in programmer mode to change the error value from decimal to hex, which turns into “A0”:
#define CKR_PIN_INCORRECT 0x000000A0
Another example whilst searching for "Rv:" within the Vault traces:
===
C_GenerateKey failed, Session=2, Rv:19
CAVLT139E Cannot load Server Key to HSM (Code: 1123, 19)
===
RV=19 in HEX is 13 ( 0x00000013 ):
CKR_ATTRIBUTE_VALUE_INVALID - An invalid value was specified for a particular attribute in a template
CKA_KEY_TYPE=31 (AES).
Then search for the Hex value in 'pkcs-11v2-11r1.pdf' ( see attached) to see more details about the message.
Additional Information
Details
Q:
How to convert HSM message code in the vault to PKCS#11 message code?
A:
HSM debug level CRYPT(1) should be enabled.
Vault HSM error codes are in decimal and the standard is to display them in Hex.
So when you receive an HSM error like:
CAVLT138E Cannot find suitable slot to store Server Key (Code: 1103, 160)
The “160” is the decimal value. You can use the windows calculator in programmer mode to change the error value from decimal to hex, which turns in “A0”
Which becomes:
#define CKR_PIN_INCORRECT 0x000000A0
Another example:
search for Rv: , like
C_GenerateKey failed, Session=2, Rv:19
CAVLT139E Cannot load Server Key to HSM (Code: 1123, 19)
RV=19 in HEX is 13 ( 0x00000013 ) - CKR_ATTRIBUTE_VALUE_INVALID - An invalid value was specified for a particular attribute in a template
CKA_KEY_TYPE=31 (AES)
Then search for the Hex value in 'pkcs-11v2-11r1.pdf' ( see attached) to see more details about the message.