All Products
Search
Document Center

Key Management Service:genRSAKeyPair

Last Updated:Mar 31, 2026

Generate an RSA asymmetric key pair on a Hardware Security Module (HSM) using the genRSAKeyPair command in the key_mgmt_tool. Specify the modulus length and public exponent to define the key. The command also lets you assign a label and ID, share the key pair with other HSM users, create nonextractable keys, and generate session keys that expire when the session ends. On success, the HSM assigns a separate key handle to the public key and the private key—use these handles to reference the keys in subsequent operations.

Prerequisites

Before you begin, ensure that you have:

Syntax

genRSAKeyPair -m <modulus length>
              -e <public exponent>
              -l <label>
              [-id <key ID>]
              [-min_srv <minimum number of servers>]
              [-m_value <0..8>]
              [-nex]
              [-sess]
              [-timeout <number of seconds>]
              [-u <user-ids>]
              [-attest]
Important

Enter parameters in the exact order shown in the syntax.

Parameters

ParameterDescriptionRequiredValid values
-mModulus length of the key, in bits.Yes2048
-ePublic exponent value.YesAn odd number ≥ 65537
-lLabel for the key pair. The same label applies to both the public key and the private key.YesAny string
-idIdentifier for the generated key pair.NoAny string
-nexPrevents the key from being exported.No
-sessMarks the key as a session key.No
-uUser IDs of HSM users authorized to use the key pair, separated by commas.No0–8 user IDs
-m_valueDefines the maximum number of users that can utilize the private key within the generated RSA key pair.No08
-attestVerifies the integrity of the HSM firmware response after key generation.No
-min_srvMinimum number of servers on which the key must be synchronized before the -timeout period expires. If synchronization does not reach this threshold in time, the key is not created.NoAny integer
-timeoutTime limit, in seconds, for the key to synchronize across the number of servers specified by -min_srv. Only applies when -min_srv is set. By default, the command waits indefinitely until synchronization completes.NoAny positive integer

Example

The following command generates a 2048-bit RSA key pair labeled rsa with public exponent 65541.

Command:  genRSAKeyPair -m 2048 -e 65541 -l rsa

          Cfm3GenerateKeyPair returned: 0x00 : HSM Return: SUCCESS

          Cfm3GenerateKeyPair:    public key handle: 14    private key handle: 15

          Cluster Status:
          Node id 0 status: 0x00000000 : HSM Return: SUCCESS

The output confirms that the key pair was created successfully. The HSM assigned handle 14 to the public key and handle 15 to the private key. Use these handles to reference the keys in subsequent commands.