本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
生成密钥
要生成 HSM 上的密钥,请使用与要生成的密钥的类型对应的命令。
生成对称密钥
使用genSymKey命令生成 AES 和其他类型的对称密钥。要查看所有可用的选项,请使用 genSymKey -h 命令。
以下示例创建 256 位 AES 密钥。
Command:
genSymKey -t 31 -s 32 -l aes256
Cfm3GenerateSymmetricKey returned: 0x00 : HSM Return: SUCCESS Symmetric Key Created. Key Handle: 524295 Cluster Error Status Node id 0 and err state 0x00000000 : HSM Return: SUCCESS Node id 1 and err state 0x00000000 : HSM Return: SUCCESS Node id 2 and err state 0x00000000 : HSM Return: SUCCESS
生成 RSA 密钥对
要生成 RSA 密钥对,请使用 genR KeyPair SA 命令。要查看所有可用的选项,请使用 genRSAKeyPair -h 命令。
以下示例生成 RSA 2048 位密钥对。
Command:
genRSAKeyPair -m 2048 -e 65537 -l rsa2048
Cfm3GenerateKeyPair returned: 0x00 : HSM Return: SUCCESS Cfm3GenerateKeyPair: public key handle: 524294 private key handle: 524296 Cluster Error Status Node id 0 and err state 0x00000000 : HSM Return: SUCCESS Node id 1 and err state 0x00000000 : HSM Return: SUCCESS Node id 2 and err state 0x00000000 : HSM Return: SUCCESS
生成 ECC (椭圆曲线加密) 密钥对
要生成 ECC 密钥对,请使用 Genec KeyPair C 命令。要查看所有可用选项(包括受支持的椭圆曲线的列表),请使用 genECCKeyPair -h 命令。
以下示例将使用 NIST FIPS 刊物 186-4
Command:
genECCKeyPair -i 14 -l ecc-p384
Cfm3GenerateKeyPair returned: 0x00 : HSM Return: SUCCESS Cfm3GenerateKeyPair: public key handle: 524297 private key handle: 524298 Cluster Error Status Node id 0 and err state 0x00000000 : HSM Return: SUCCESS Node id 1 and err state 0x00000000 : HSM Return: SUCCESS Node id 2 and err state 0x00000000 : HSM Return: SUCCESS