RSA BSAFE Cert-C Micro Edition

The power of PKI for the smallest of devices

Symmetric Operation Functions

This section outlines the functions that facilitate the encryption and decryption of data in symmetric cryptographic operations.

Functions

int R_CR_encrypt_init (R_CR *crypto, R_SKEY *key, R_ITEM *iv)
 Initializes a cryptographic object for encryption. More...

int R_CR_encrypt (R_CR *crypto, unsigned char *data, unsigned int dlen, unsigned char *out, unsigned int *olen)
 Encrypts a single block of data and calls the implementations of update and final automatically. More...

int R_CR_encrypt_update (R_CR *crypto, unsigned char *data, unsigned int dlen, unsigned char *out, unsigned int *olen)
 Encrypts a single block of data. More...

int R_CR_encrypt_final (R_CR *crypto, unsigned char *out, unsigned int *olen)
 Finalizes the encryption process. More...

int R_CR_decrypt_init (R_CR *crypto, R_SKEY *key, R_ITEM *iv)
 Initializes a cryptographic operation object for decryption. More...

int R_CR_decrypt (R_CR *crypto, unsigned char *data, unsigned int dlen, unsigned char *out, unsigned int *olen)
 Decrypts a block of data and calls the implementations of update and final automatically. More...

int R_CR_decrypt_update (R_CR *crypto, unsigned char *data, unsigned int dlen, unsigned char *out, unsigned int *olen)
 Decrypts a block of data. More...

int R_CR_decrypt_final (R_CR *crypto, unsigned char *out, unsigned int *olen)
 Finalizes the decryption process. More...


Function Documentation

int R_CR_decrypt R_CR   crypto,
unsigned char *    data,
unsigned int    dlen,
unsigned char *    out,
unsigned int *    olen
;
 

Decrypts a block of data and calls the implementations of update and final automatically.

Parameters:
crypto [In] A pointer to the cryptographic object.
Must be allocated the correct type and initialized by calls to R_CR_new() and R_CR_decrypt_init() respectively.
data [In] A pointer to the data to decrypt.
dlen [In] The number of Bytes to decrypt.
out [Out] The buffer that takes the plain text.
Must be of sufficient length to contain the final block of data.
olen [In, Out] The length of the returned data, in out.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_decrypt_init().

int R_CR_decrypt_final R_CR   crypto,
unsigned char *    out,
unsigned int *    olen
;
 

Finalizes the decryption process. Indicates that the last block of data has been passed to the algorithm. It triggers the possible removal of padding Bytes and the return of the last block of plaintext to the caller.

Parameters:
crypto [In] A pointer to the cryptographic object.
Must have been allocated the correct type and initialized by calls to R_CR_new() and R_CR_decrypt_update() respectively.
out [Out] The buffer that takes the plaintext.
Must be of sufficient length to contain the final block of data.
olen [In, Out] The length of the returned data, in out.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_decrypt_init() and R_CR_decrypt_update().

int R_CR_decrypt_init R_CR   crypto,
R_SKEY   key,
R_ITEM   iv
;
 

Initializes a cryptographic operation object for decryption.

Parameters:
crypto [In] A pointer to the cryptographic object.
Must have been allocated the correct type via R_CR_new().
key [In] The key to use.
iv [In] The Initialization Vector (IV) used for the chaining/feedback modes.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_decrypt_update() and R_CR_decrypt_final().

int R_CR_decrypt_update R_CR   crypto,
unsigned char *    data,
unsigned int    dlen,
unsigned char *    out,
unsigned int *    olen
;
 

Decrypts a block of data. Call R_CR_decrypt_final() after all blocks of data have been processed to complete the decryption process.

Parameters:
crypto [In] A pointer to the cryptographic object.
Must be allocated the correct type and initialized by calls to R_CR_new() and R_CR_decrypt_init() respectively.
data [In] A pointer to the data to decrypt.
dlen [In] The number of Bytes to decrypt.
out [Out] The buffer that takes the plain text.
Must be of sufficient length to contain the decrypted data.
olen [In, Out] The length of the returned data, in out.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_decrypt_init() and R_CR_decrypt_final().

int R_CR_encrypt R_CR   crypto,
unsigned char *    data,
unsigned int    dlen,
unsigned char *    out,
unsigned int *    olen
;
 

Encrypts a single block of data and calls the implementations of update and final automatically.

Parameters:
crypto [In] A pointer to the cryptographic object.
Must have been successfully allocated by calls to R_CR_new() and R_CR_encrypt_init().
data [In] A pointer to the data to encrypt.
dlen [In] The number of Bytes to encrypt.
out [Out] The buffer that takes the cipher text.
Must be of sufficient length to contain the final block of data.
olen [In, Out] The length of the returned data, in out.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_encrypt_init().

int R_CR_encrypt_final R_CR   crypto,
unsigned char *    out,
unsigned int *    olen
;
 

Finalizes the encryption process. Indicates that the last block of data has been passed to the algorithm and triggers possible padding, and the return of the last block of cipher text to the caller. All data to encrypt must have been processed by calls to R_CR_encrypt_update().

Parameters:
crypto [In] A pointer to the cryptographic object. Must have been successfully allocated the correct type and initialized via R_CR_new() and R_CR_encrypt_init() respectively.
out [Out] The buffer that takes the cipher text.
olen [In, Out] The length of the returned data.
Must be allocated sufficient length to contain the final block of data. The allocated length is initially set in olen.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_new(), R_CR_encrypt_init() and R_CR_encrypt_update().

int R_CR_encrypt_init R_CR   crypto,
R_SKEY   key,
R_ITEM   iv
;
 

Initializes a cryptographic object for encryption.

Parameters:
crypto [In] A pointer to the cryptographic object.
Must be allocated the correct type via R_CR_new().
key [In] The key to use.
iv [In] The Initialization Vector (IV) used in chaining/feedback modes.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_encrypt_update(), R_CR_encrypt_final() and R_CR_encrypt().

int R_CR_encrypt_update R_CR   crypto,
unsigned char *    data,
unsigned int    dlen,
unsigned char *    out,
unsigned int *    olen
;
 

Encrypts a single block of data. Call R_CR_encrypt_final() after all blocks of data have been processed to complete the encryption process.

Parameters:
crypto [In] A pointer to the cryptographic object.
Must have been allocated the correct type and initialized via R_CR_new() and R_CR_encrypt_init() respectively.
data [In] A pointer to the data to encrypt.
dlen [In] The number of Bytes to encrypt.
out [Out] The buffer that takes the cipher text.
Must be of sufficient length to contain the encrypted data.
olen [In, Out] The length of the returned data in out.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_encrypt_init() and R_CR_encrypt_final().


Copyright (c) 1999-2002 RSA Security Inc. All rights reserved. 061-001005-150-001-000-3768 - 1.5