The X9.31 Sample Program

The X9.31 Sample Program

#include <stdio.h> #include <string.h> #include <time.h> #include "aglobal.h" #include "bsafe.h"

B_ALGORITHM_METHOD *X931_SAMPLE_CHOOSER[] = { &AM_X931_RANDOM,

&AM_SHA,

&AM_FORMAT_X931,

&AM_RSA_CRT_X931_ENCRYPT, &AM_EXTRACT_X931, &AM_RSA_X931_DECRYPT, &AM_RSA_STRONG_KEY_GEN, &AM_SHA_RANDOM, (B_ALGORITHM_METHOD *)NULL_PTR

};

#define NUMBER_OF_RANDOM_BYTES 128 #define RSA_MODULUS_BITS 512

int GeneralSurrenderFunction PROTO_LIST ((POINTER handle));

void PrintBuf PROTO_LIST ((unsigned char *, unsigned int));

void main()

{

B_ALGORITHM_OBJ randomAlgorithm = (B_ALGORITHM_OBJ)NULL_PTR; B_ALGORITHM_OBJ keypairGenerator = (B_ALGORITHM_OBJ)NULL_PTR; B_ALGORITHM_OBJ digitalSigner = (B_ALGORITHM_OBJ)NULL_PTR; B_ALGORITHM_OBJ digitalVerifier = (B_ALGORITHM_OBJ)NULL_PTR; B_KEY_OBJ publicKey = (B_KEY_OBJ)NULL_PTR;

B_KEY_OBJ privateKey = (B_KEY_OBJ)NULL_PTR;

ITEM randomSeed;

unsigned char *randomByteBuffer = NULL_PTR; A_X931_RANDOM_PARAMS x931Params;

A_RSA_KEY_GEN_PARAMS keygenParams;

A_X931_PARAMS x931params;

B_SIGN_VERIFY_PARAMS signVerifyParams;

3 1 4

R S A B S A F E C r y p t o - C D e v e l o p e r ’s G u i d e

Page 336
Image 336
RSA Security 5.2.2 manual X9.31 Sample Program, Bkeyobj privateKey = Bkeyobjnullptr Item randomSeed