CSSM_CSP_CreateDeriveKeyContext
CSSM_CC_HANDLE CSSMAPI CSSM_CSP_CreateDeriveKeyContext
(CSSM_CSP_HANDLE CSPHandle,
uint32 AlgorithmID,
CSSM_KEY_TYPE DeriveKeyType,
uint32 DeriveKeyLengthInBits,
uint32 IterationCount,
const CSSM_DATA_PTR Salt,
const CSSM_CRYPTO_DATA_PTR Seed,
const CSSM_CRYPTO_DATA_PTR PassPhrase)
This function creates a cryptographic context to derive a symmetric key given a handle of a CSP, an algorithm, the type of symmetric key to derive, the length of the derived key, and an optional seed or an optional passphrase from which to derive a new key. The cryptographic context handle is returned. The cryptographic context handle can be used for calling the cryptographic derive key function.
- 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 a derived key algorithm.
- DeriveKeyType (input)
The type of symmetric key to derive.
- DeriveKeyLengthInBits (input)
The length of the key to derive in bits.
- InterationCount (input/optional)
The number of iterations to be performed during the derivation process. Used heavily by password-based derivation methods.
- Salt (input/optional)
A Salt used in deriving the key.
- Seed (input/optional)
A seed used to generate a random number. The caller can either pass a seed and seed length in bytes or pass in a callback function. If NULL is passed, the cryptographic service provider will use its default seed handling mechanism.
- PassPhrase (input/optional)
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.
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_DeriveKey
Contents | Next section | Index |