MultiPrime

B_ALGORITHM_METHOD *RSA_GEN_CHOOSER[] = { &AM_RSA_KEY_GEN, (B_ALGORITHM_METHOD *)NULL_PTR

};

A_RSA_MULTI_PRIME_KEY_GEN_PARAMS genParams; ITEM *privateKeyBER = (ITEM *)NULL_PTR; unsigned char expo[1] = {

3

};

do {

if ((status = B_CreateKeyObject (&pubKey)) != 0) break;

if ((status = B_CreateKeyObject (&priKey)) != 0) break;

if ((status = B_CreateAlgorithmObject (&rsaGen)) != 0) break;

genParams.modulusBits = 1024; genParams.numberOfPrimes = 3; genParams.publicExponent.data = expo; genParams.publicExponent.len = sizef (expo); if ((status = B_SetAlgorithmInfo

(rsaGen, AI_RSAMultiPrimeKeyGen, (POINTER)&genParams)) != 0)

break;

if ((status =

B_GenerateInit

(rsaGen,

RSA_GEN_CHOOSER, NULL_SURR)) != 0)

break;

 

if ((status =

B_GenerateKeypair

(rsaGen,

pubKey, priKey, rand, NULL_SURR)) != 0)

break;

 

if ((status =

B_GetKeyInfo

((POINTER *)&privateKeyBER, priKey, KI_PKCS_RSAPrivateBER)) != 0)

break;

} while (0);

C h a p t e r 7 P u b l i c - K e y O p e r a t i o n s

2 2 1

Page 243
Image 243
RSA Security 5.2.2 manual BGenerateInit, RsaGen, BGenerateKeypair, BGetKeyInfo, Break While