NAME
CSSM_EncryptData, CSP_EncryptData — Encrypts all buffer data (CDSA)
SYNOPSIS
# include <cssm.h>
API: CSSM_RETURN CSSMAPI CSSM_EncryptData (CSSM_CC_HANDLE CCHandle, const CSSM_DATA *ClearBufs, uint32 ClearBufCount, CSSM_DATA_PTR CipherBufs, uint32 CipherBufCount, uint32 *bytesEncrypted, CSSM_DATA_PTR RemData) SPI: CSSM_RETURN CSSMCSPI CSP_EncryptData (CSSM_CSP_HANDLE CSPHandle, CSSM_CC_HANDLE CCHandle, const CSSM_CONTEXT *Context, const CSSM_DATA *ClearBufs, uint32 ClearBufCount, CSSM_DATA_PTR CipherBufs, uint32 CipherBufCount, uint32 *bytesEncrypted, CSSM_DATA_PTR RemData, CSSM_PRIVILEGE Privilege)
|
LIBRARY
Common Security Services Manager library (cdsa$incssm300_shr.exe)
API PARAMETERS
CCHandle (input) | | The handle that describes the context of this cryptographic
operation used to link to the CSP-managed information. |
ClearBufs (input) |
| | A pointer to a vector of CSSM_DATA structures that
contain the data to be operated on. |
ClearBufCount (input) |
| | The number of ClearBufs. |
CipherBufs (output) |
| | A pointer to a vector of CSSM_DATA structures that
contain the results of the operation on the data. |
CipherBufCount (input) |
| | The number of CipherBufs. |
bytesEncrypted (output) |
| | A pointer to uint32 for the size
of the encrypted data in bytes. |
RemData (output) | | A pointer to the CSSM_DATA structure for the remaining
cipher text if there is not enough buffer space available in the
output data structures. |
SPI PARAMETERS
CSPHandle (input) |
| | The handle that describes the add-in Cryptographic
Service Provider module used to perform calls to CSSM for the memory
functions managed by CSSM. |
Context (input) | | Pointer to CSSM_CONTEXT structure that describes
the attributes with this context. |
Privilege (input) |
| | The export privilege to be applied during the cryptographic
operation. This parameter is forwarded to the CSP after CSSM verifies
the caller and service provider privilege set includes the specified
PRIVILEGE. |
DESCRIPTION
This function encrypts all data contained in the set of input
buffers using information in the context. The CSSM_QuerySize() function can be used to estimate the output buffer size
required. The minimum number of buffers required to contain the
resulting cipher text is produced as output. If the cipher text
result does not fit within the set of output buffers, the remaining
cipher text is returned in the single output buffer RemData.
The CSP can require that the cryptographic context include
access credentials for authentication and authorization checks when
using a private key or a secret key.
NOTES FOR API
The output is returned to the caller either by filling the
caller-specified buffer or by using the application's declared memory
allocation functions to allocate buffer space. To specify a specific,
preallocated output buffer, the caller must provide an array of
one or more CSSM_DATA structures, each containing a Length field
value greater than zero and a non-NULL data pointer field value.
To specify automatic output buffer allocation by the CSP, the caller
must provide an array of one or more CSSM_DATA structures, each
containing a Length field value equal to zero and a NULL Data pointer
field value. The application is always responsible for deallocating
the memory when it is no longer needed. In-place encryption can
be done by supplying the same input and output buffers.
NOTES FOR SPI
The output is returned to the caller as specified in Buffer
Management for Cryptographic Services.
RETURN VALUE
A CSSM_RETURN value indicating success or specifying a particular
error condition. The value CSSM_OK indicates success. All other
values represent an error condition.
ERRORS
Errors are described in the CDSA Technical Standard.
CSSMERR_CSP_BLOCK_SIZE_MISMATCH CSSMERR_CSP_OUTPUT_LENGTH_ERROR
|
SEE ALSO
Books
Intel CDSA Application Developer's Guide
Online Help
Functions for the CSSM API:
CSSM_QuerySize, CSSM_DecryptData, CSSM_EncryptDataInit, CSSM_EncryptDataUpdate, CSSM_EncryptDataFinal, CSSM_EncryptDataP, CSSM_EncryptDataInitP, CSSM_DecryptP, CSSM_DecryptDataInitP
Functions for the CSP SPI:
CSP_QuerySize, CSP_DecryptData, CSP_EncryptDataInit, CSP_EncryptDataUpdate, CSP_EncryptDataFinal