CSSM_QueryKeySizeInBits
CSSM_RETURN CSSMAPI CSSM_QueryKeySizeInBits
(CSSM_CSP_HANDLE CSPHandle,
CSSM_CC_HANDLE CCHandle,
const CSSM_KEY_PTR Key,
CSSM_KEY_SIZE_PTR KeySize)
This function queries a crypto service provider for the effective and real size of a key in bits.The key can be specified alone or in the context of a cryptographic context. If specified alone, the CSP determines the effective bit size of the key based on the real bit size and any known constraints on the usage of that key. If a cryptographic context is provided, the effective bit size of the key is determined based on the assumption that the key would be used to perform the operation described by that cryptographic context.
- CSPHandle (input)
The handle that describes the add-in cryptographic service provider module used to perform this function.
- CCHandle (input/optional)
A handle to the cryptographic context describing the operation for which the effective bit size of the key should be determined. If the context is specified, it must contain the key whose effective bit size is being queried. If the cryptographic context is not specified, then the key must be provided in the optional Key input parameter.
- Key (input/optional)
A pointer to a CSSM_KEY structure containing the key for which size is to be determined. If the specific cryptographic context in which the key is to be used is not known the key must be specified alone in this parameter and the cryptographic context input parameter must be NULL. If the context is known and is specified by the CCHandle input parameter, then the key must be contained in the context structure and the Key input parameter must be NULL.
- KeySize (output)
Pointer to a CSSM_KEY_SIZE data structure returns the actual size and the effective size of the key in bits.
A CSSM return value. This function returns CSSM_OK if successful, and returns an error code if an error has occurred.
- CSSM_CSP_INVALID_CONTEXT_HANDLE
Invalid context handle.
- CSSM_CSP_INVALID_KEY_POINTER
Key pointer is missing or invalid.
- CSSM_CSP_INVALID_KEY
Invalid key buffer.
- CSSM_CSP_INVALID_POINTER
Invalid output CSSM_KEY_SIZE pointer.
- CSSM_CSP_OPERATION_UNSUPPORTED
Query key size in bits service not supported.
- CSSM_CSP_OPERATION_FAILED
Cryptographic operation failed.
CSSM_GenerateRandom, CSSM_GenerateKeyPair
Contents | Next section | Index |