Previous section.

Common Security: CDSA and CSSM
Copyright © 1997 The Open Group

NAME

CSP_QueryKeySizeInBits

SYNOPSIS

CSSM_RETURN CSSMSPI CSP_QueryKeySizeInBits
    (CSSM_CSP_HANDLE CSPHandle,
    CSSM_CC_HANDLE CCHandle,
    const CSSM_KEY_PTR Key,
    CSSM_KEY_SIZE_PTR KeySize)

DESCRIPTION

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.

PARAMETERS

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 error.

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_KEYSIZE data structure to receive the size of the key in bits.

RETURN VALUE

A CSSM return value. This function returns CSSM_OK if successful, and returns an error code if an error has occurred.

ERRORS

CSSM_CSP_INVALID_CSP_HANDLE

Invalid CSP handle.

CSSM_CSP_INVALID_CONTEXT_HANDLE

Invalid context handle.

CSSM_CSP_INVALID_CONTEXT_POINTER

Invalid CSSM_CONTEXT pointer.

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.


Why not acquire a nicely bound hard copy?
Click here to return to the publication details or order a copy of this publication.
You should also read the legal notice explaining the terms and conditions relating to the CDSA documentation.

Contents Next section Index