RSA Security 5.2.2 Projection Television User Manual


 
Performing DSA Operations
244 RSA BSAFE Crypto-C Developers Guide
Computing a Digital Signature
Step 1: Creating An Algorithm Object
Declare a variable to be B_ALGORITHM_OBJ. As defined in the function prototype in
Chapter 4 of the Reference Manual, its address is the argument for
B_CreateAlgorithmObject:
Step 2: Setting The Algorithm Object
There is only one Crypto-C choice for computing DSA digital signatures,
AI_DSAWithSHA1 (or its BER counterpart). The Reference Manual Chapter 2 entry for
this AI states that the format of
info
supplied to B_SetAlgorithmInfo is NULL_PTR.
Step 3: Init
Associate a key and algorithm method with the algorithm object through B_SignInit.
The Chapter 4 Reference Manual entry on this function shows that it takes four
arguments: the algorithm object, a key object, an algorithm chooser and a surrender
context. The algorithm object in this example is
dsaSigner
. For a key object you want
to use a DSA private key. See the previous section on generating a DSA key pair.
Build an algorithm chooser, the elements being the AMs listed in the Reference Manual
Chapter 2 entry for the AI in use.
B_SignInit is fast, so it is reasonable to pass a
B_ALGORITHM_OBJ dsaSigner = (B_ALGORITHM_OBJ)NULL_PTR;
if ((status = B_CreateAlgorithmObject (&dsaSigner)) != 0)
break;
if ((status = B_SetAlgorithmInfo
(dsaSigner, AI_DSAWithSHA1, NULL_PTR)) != 0)
break;