CSSM_CSP_CreateAsymmetricContext
CSSM_CC_HANDLE CSSMAPI CSSM_CSP_CreateAsymmetricContext
(CSSM_CSP_HANDLE CSPHandle,
uint32 AlgorithmID,
const CSSM_CRYPTO_DATA_PTR PassPhrase,
const CSSM_KEY_PTR Key,
uint32 Padding)
This function creates an asymmetric encryption cryptographic context, given a handle of a CSP, an algorithm identification number, a key, padding, and the key mode (CSSM_ALGMODE_PRIVATE_KEY or CSSM_ALGMODE_PUBLIC_KEY). The cryptographic context handle is returned. The cryptographic context handle can be used to call asymmetric encryption functions and cryptographic wrap/unwrap functions.
- CSPHandle (input)
The handle that describes the add-in cryptographic service provider module used to perform this function. If a NULL handle is specified, CSSM returns an error.
- AlgorithmID (input)
The algorithm identification number for the algorithm used for asymmetric encryption.
- PassPhrase (input)
The passphrase is required to unlock the private key. The passphrase structure accepts an immediate value for the passphrase or the caller can specify a callback function the CSP can use to obtain the passphrase. The passphrase is needed only for signature operations, not verify operations. When the context is used for a wrap or unwrap operation, the passphrase can be used to generate a symmetric key for wrapping or unwrapping.
- Key (input)
The key used for asymmetric encryption. The caller passes a pointer to a CSSM_KEY structure containing the key. When the context is used for a sign operation, the passphrase is required to access the private key used for signing. When the context is used for a verify operation, the public key is used to verify the signature. When the context is used for a wrapkey operation, the public key can be used as the wrapping key. When the context is used for an unwrap operation, the passphrase is required to access the private key used to perform the unwrapping.
- Padding (input/optional)
The method for padding. Typically specified for ciphers that pad.
Returns a cryptographic context handle. If the handle is NULL, an error has occurred. Use CSSM_GetError to obtain the error code.
- CSSM__INVALID_CSP_HANDLE
Invalid provider handle.
- CSSM__MEMORY_ERROR
Internal memory error.
CSSM_EncryptData, CSSM_QuerySize, CSSM_EncryptDataInit, CSSM_EncryptDataUpdate, CSSM_EncryptDataFinal, CSSM_DecryptData, CSSM_DecryptDataInit, CSSM_DecryptDataUpdate, CSSM_DecryptDataFinal, CSSM_GetContext, CSSM_SetContext, CSSM_DeleteContext, CSSM_GetContextAttribute, CSSM_UpdateContextAttributes
Contents | Next section | Index |