RSA BSAFE Cert-C Micro Edition

The power of PKI for the smallest of devices

Signature Operation Functions

This section outlines the functions that facilitate the signing and verification of data in non-repudiation operations.

Functions

int R_CR_sign_init (R_CR *crypto, R_PKEY *key)
 Initializes a signing operation. More...

int R_CR_sign (R_CR *crypto, unsigned char *data, unsigned int dlen, unsigned char *out, unsigned int *olen)
 Signs a single block of data in accordance with the selected algorithm. More...

int R_CR_sign_update (R_CR *crypto, unsigned char *data, unsigned int dlen)
 Processes a block of data for signing. More...

int R_CR_sign_final (R_CR *crypto, unsigned char *out, unsigned int *olen)
 Finalizes the signing process and returns the signature for the previously processed data. More...

int R_CR_verify_init (R_CR *crypto, R_PKEY *key)
 Initializes a signature verify operation. More...

int R_CR_verify (R_CR *crypto, unsigned char *data, unsigned int dlen, unsigned char *signature, unsigned int slen, int *result)
 Verifies a single block of data against a signature. More...

int R_CR_verify_update (R_CR *crypto, unsigned char *data, unsigned int dlen)
 Processes a block of data for signature verification. More...

int R_CR_verify_final (R_CR *crypto, unsigned char *signature, unsigned int sig_len, int *result)
 Finalizes the signature verification process by verifying data previously processed by R_CR_verify_update(), and comparing it against the signature. More...


Function Documentation

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

Signs a single block of data in accordance with the selected algorithm.

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_sign_init() respectively.
data [In] A pointer to the data to sign.
dlen [In] The number of Bytes to sign.
out [Out] The buffer that takes the signed data.
Must be allocated sufficient length to contain the result.
olen [In, Out] The length of the signed data returned, in out.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_sign_init().

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

Finalizes the signing process and returns the signature for the previously processed data. All data to encrypt has been processed via R_CR_sign_update().

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_sign_init() respectively.
out [Out] The buffer that takes the signed data.
Must be of sufficient length to contain the final block of data.
olen [In, Out] The length of the signed data, in out.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_sign_init() and R_CR_sign_update().

int R_CR_sign_init R_CR   crypto,
R_PKEY   key
;
 

Initializes a signing operation.

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.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_sign_update(),R_CR_sign_final() and R_CR_sign().

int R_CR_sign_update R_CR   crypto,
unsigned char *    data,
unsigned int    dlen
;
 

Processes a block of data for signing. Retrieves the result via R_CR_sign_final().

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_sign_init() respectively.
data [In] A pointer to the data to sign.
dlen [In] The length of data.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_sign_init() and R_CR_sign_final().

int R_CR_verify R_CR   crypto,
unsigned char *    data,
unsigned int    dlen,
unsigned char *    signature,
unsigned int    slen,
int *    result
;
 

Verifies a single block of data against a signature. The signature is decrypted and the decrypted hash is compared with the hash of the data.

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_verify_init() respectively.
data [In] A pointer to the data to verify.
dlen [In] The length of data.
signature [In] A pointer to the signature attached to the data.
slen [In] The length of the signature.
result [Out] The result of verification.
Cannot be passed as NULL.
Returns:
R_ERROR_NONE indicates success.
See Error Identifiers for valid values.
See also:
R_CR_verify_init().

int R_CR_verify_final R_CR   crypto,
unsigned char *    signature,
unsigned int    sig_len,
int *    result
;
 

Finalizes the signature verification process by verifying data previously processed by R_CR_verify_update(), and comparing it against the signature.

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_verify_init() respectively.
signature [In] A pointer to the signature attached to data.
sig_len [In] The length of the signature.
result [Out] The verification result. One of:
  • R_ERROR_NONE indicates success.
  • R_ERROR_FAILED indicates error.
  • Returns:
    R_ERROR_NONE indicates success.
    See Error Identifiers for valid values.
    See also:
    R_CR_verify_init() and R_CR_verify_update().

    int R_CR_verify_init R_CR   crypto,
    R_PKEY   key
    ;
     

    Initializes a signature verify operation.

    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.
    Returns:
    R_ERROR_NONE indicates success.
    See Error Identifiers for valid values.
    See also:
    R_CR_verify_update(), R_CR_verify_final() and R_CR_verify().

    int R_CR_verify_update R_CR   crypto,
    unsigned char *    data,
    unsigned int    dlen
    ;
     

    Processes a block of data for signature verification. The result must be retrieved by a call to R_CR_verify_final().

    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_verify_init() respectively.
    data [In] A pointer to the data to verify.
    dlen [In] The length of data.
    Returns:
    R_ERROR_NONE indicates success.
    See Error Identifiers for valid values.
    See also:
    R_CR_verify_init() and R_CR_verify_final().


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