RSA BSAFE Cert-C Micro Edition

The power of PKI for the smallest of devices

Cryptographic Message Functions

This section details the functions that facilitate cryptographic message objects.

Functions

int R_CM_free (R_CM *msg)
 Deallocates the cryptographic message msg and all associated data. More...

int R_CM_from_binary (R_CM_CTX *ctx, int flag, R_CM_TYPE type, int encoding_format, size_t max_buf_len, unsigned char *buf, size_t *consumed_len, R_CM **msg)
 Creates a cryptographic message from the specified binary data. More...

int R_CM_get_info (R_CM *msg, R_CM_INFO info_id, void *value)
 Retrieves information from the cryptographic message. More...

int R_CM_set_info (R_CM *msg, R_CM_INFO info_id, void *value)
 Sets information into the cryptographic message. More...

int R_CM_read (R_CM_CTX *ctx, BIO *bio, R_CM_FORMAT format, int encoding_format, R_CM **msg)
 Reads the cryptographic message from a BIO into the cryptographic message object. More...

int R_CM_read_file (R_CM_CTX *ctx, char *filename, R_CM_FORMAT format, int encoding_format, R_CM **msg)
 Reads the cryptographic message from a file into the cryptographic message object. More...

int R_CM_TYPE_from_string (char *str, R_CM_TYPE *type)
 Converts a cryptographic message type string to a cryptographic message type value. More...

int R_CM_TYPE_to_string (R_CM_TYPE type, size_t max_str_len, char *str)
 Converts a cryptographic message type value to a cryptographic message type string. More...

int R_CM_FORMAT_from_string (char *str, R_CM_FORMAT *format)
 Converts the string str into a format identifier. More...

int R_CM_FORMAT_to_string (R_CM_FORMAT format, size_t max_str_len, char *str)
 Returns the string representation of the format identifier type. More...


Function Documentation

int R_CM_FORMAT_from_string char *    str,
R_CM_FORMAT   format
;
 

Converts the string str into a format identifier. This function is used for interpreting user input.

Parameters:
str [In] Character string.
format [Out] Format identifier.
See Cryptographic Message I/O Formats for the identifiers and the corresponding input strings.
Returns:
R_ERROR_NONE indicates success.
See R_ERROR Identifiers for other values.
See also:
R_CM_FORMAT_to_string().

int R_CM_FORMAT_to_string R_CM_FORMAT    format,
size_t    max_str_len,
char *    str
;
 

Returns the string representation of the format identifier type.

Parameters:
format [In] Format type.
max_str_len [In] Amount of memory allocated to string.
str [Out] Character string.
See Cryptographic Message I/O Formats for the identifiers and the corresponding output strings.
Returns:
R_ERROR_NONE indicates success.
See R_ERROR Identifiers for other values.
Note:
The maximum length a cryptographic message type string can be is R_CM_TYPE_MAX_STR_LENGTH.
See also:
R_CM_FORMAT_from_string().

int R_CM_free R_CM   msg ;
 

Deallocates the cryptographic message msg and all associated data. Data referenced by the object is not deallocated.

Parameters:
msg [In] The cryptographic message to be deallocated.
Returns:
R_ERROR_NONE for success.
See R_ERROR Identifiers for other values.
See also:
R_CM_new(), R_CM_CTX_new() and R_CM_CTX_free().

int R_CM_from_binary R_CM_CTX   ctx,
int    flag,
R_CM_TYPE    type,
int    encoding_format,
size_t    max_buf_len,
unsigned char *    buf,
size_t *    consumed_len,
R_CM **    msg
;
 

Creates a cryptographic message from the specified binary data.

Parameters:
ctx [In] The cryptographic message context.
flag [In] The data to be referenced or copied.
type [In] The type of cryptographic message.
See Cryptographic Message Types for valid values.
encoding_format [In] Format of the encoding.
max_buf_len [In] The length of the binary data.
buf [In] Binary data buffer holding the cryptographic message.
consumed_len [Out] Amount of data used in creating cryptographic message.
msg [Out] The created cryptographic message.
Returns:
R_ERROR_NONE for success.
See R_ERROR Identifiers for other values.
See also:
R_CM_to_binary(), R_CM_read(), R_CM_read_file(), R_CM_write() and R_CM_write_file().

int R_CM_get_info R_CM   msg,
R_CM_INFO    info_id,
void *    value
;
 

Retrieves information from the cryptographic message.

Parameters:
msg [In] The cryptographic message.
info_id [In] Identifier of the information to get from the cryptographic message.
See Cryptographic Message Info Identifiers Group for valid values and the data type to pass into value.
value [Out] The requested information.
Returns:
R_ERROR_NONE for success.
See R_ERROR Identifiers for other values.

int R_CM_read R_CM_CTX   ctx,
BIO   bio,
R_CM_FORMAT    format,
int    encoding_format,
R_CM **    msg
;
 

Reads the cryptographic message from a BIO into the cryptographic message object.

Parameters:
ctx [In] The cryptographic message context.
bio [In] The BIO from which to retrieve the cryptographic message.
format [In] Format of the cryptographic message to read in.
See Cryptographic Message I/O Formats for valid values.
encoding_format [In] Format of the encoding.
msg [Out] The cryptographic message.
Returns:
R_ERROR_NONE for success.
See R_ERROR Identifiers for other values.
See also:
R_CM_read_file(), R_CM_to_binary() and R_CM_from_binary().

int R_CM_read_file R_CM_CTX   ctx,
char *    filename,
R_CM_FORMAT    format,
int    encoding_format,
R_CM **    msg
;
 

Reads the cryptographic message from a file into the cryptographic message object.

Parameters:
ctx [In] The cryptographic message context.
filename [In] The name of the file from which to retrieve the cryptographic message.
format [In] Format of the cryptographic message to read in.
See Cryptographic Message I/O Formats for valid values.
encoding_format [In] Format of the encoding.
msg [Out] The cryptographic message.
Returns:
R_ERROR_NONE for success.
See R_ERROR Identifiers for other values.
See also:
R_CM_read(), R_CM_to_binary() and R_CM_from_binary().

int R_CM_set_info R_CM   msg,
R_CM_INFO    info_id,
void *    value
;
 

Sets information into the cryptographic message.

Parameters:
msg [In] The cryptographic message.
info_id [In] Identifier of the information to set into the cryptographic message.
See Cryptographic Message Info Identifiers Group for valid values and the data type specified in value.
value [Out] The information that is to be set.
Returns:
R_ERROR_NONE for success.
See R_ERROR Identifiers for other values.
See also:
R_CM_get_info().

int R_CM_TYPE_from_string char *    str,
R_CM_TYPE   type
;
 

Converts a cryptographic message type string to a cryptographic message type value.

Parameters:
str [In] Cryptographic message type string.
type [Out] Cryptographic message type value.
See Cryptographic Message Types for a list of valid values and their corresponding input string.
Returns:
R_ERROR_NONE indicates success.
See R_ERROR Identifiers for other values.
See also:
R_CM_TYPE_to_string().

int R_CM_TYPE_to_string R_CM_TYPE    type,
size_t    max_str_len,
char *    str
;
 

Converts a cryptographic message type value to a cryptographic message type string.

Parameters:
type [In] Certificate request type value.
See Cryptographic Message Types for a list of valid values and their corresponding output string.
max_str_len [In] Amount of memory allocated to string.
str [Out] Certificate request type string.
Returns:
R_ERROR_NONE indicates success.
See R_ERROR Identifiers for other values.
Note:
The maximum length a cryptographic message type string can be is R_CM_TYPE_MAX_STR_LENGTH.
See also:
R_CM_TYPE_from_string().


Copyright (c) 1999-2002 RSA Security Inc. All rights reserved. 061-001007-100-001-000-3405 A1 - 1.0