z/OS Open Cryptographic Services Facility Application Programming
Previous topic | Next topic | Contents | Index | Contact z/OS | Library | PDF


CSSM_GenerateKeyPair

z/OS Open Cryptographic Services Facility Application Programming
SC24-5899-01

Purpose

This function generates an asymmetric key pair.

Format

CSSM_RETURN CSSMAPI CSSM_GenerateKeyPair 
               (CSSM_CC_HANDLE CCHandle,
                uint32 PublicKeyUsage
                uint32 PublicKeyAttr,
                const CSSM_DATA_PTR PublicKeyLabel,
                CSSM_KEY_PTR PublicKey,
                uint32 PrivateKeyUsage,
                uint32 PrivateKeyAttr,
                const CSSM_DATA_PTR PrivateKeyLabel,
                CSSM_KEY_PTR PrivateKey)

Parameters

Input

CCHandle
The handle that describes the context of this cryptographic operation used to link to the CSP-managed information.

Output

PublicKey
Pointer to CSSM_KEY structure used to obtain the public key.
PrivateKey
Pointer to CSSM_KEY structure used to obtain the private key.

Input/optional

PublicKeyUsage
A bit-mask representing the valid uses of the public key. This field may be required by some CSP modules. Refer to the information provided with the CSP for more information. See Table 36 for a list of valid key usage values.
PublicKeyAttr
A bit-mask representing the attributes of the public key represented by the data. These attributes are used by CSP service providers to convey information about stored or referenced keys. This field may be required by some CSP modules. Refer to the information provided with the CSP for more information.
PublicKeyLabel
Pointer to a byte string that will be used as a label/identifier for the derived public key. If a key label is not used, this field should be set to NULL.
PrivateKeyUsage
A bit-mask representing the valid uses of the private key. This field may be required by some CSP modules. For more information, see the information provided with the CSP from the module vendor. See Table 36 for a list of valid key usage values.
PrivateKeyAttr
A bit-mask representing the attributes of the private key represented by the data. These attributes are used by CSP service providers to convey information about stored or referenced keys. This field may be required by some CSP modules. Refer to the information provided with the CSP for more information.
PrivateKeyLabel
Pointer to a byte string that will be used as a label/identifier for the derived private key. If a key label is not used, this field should be set to NULL.

Return Value

CSSM_OK if the function was successful. CSSM_FAIL if an error occurred. Use CSSM_GetError to determine the exact error.

Notes

The KeyData field of the CSSM_KEY structures are not required to be allocated. In this case, the memory required to represent the key is allocated by the CSP. The application is required to free this memory. The CSP will only allocate memory if the Data field of KeyData is NULL and the Length field is zero.

Related Information

CSSM_GenerateRandom

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014