RSA Security 5.2.2 Projection Television User Manual


 
MultiPrime
222 RSA BSAFE Crypto-C Developers Guide
Generating an RSA MultiPrime Key
Refer to the RSA_CreateMultiPrimeRSAKeypair routine defined in the samples/pkalg/
rsa/rsautil.c
file for an example that shows the use of AI_RSAMultiPrimeKeyGen to
generate an RSA public/private key pair. This routine is called by the
rsamultp.c
sample.
RSA MultiPrime key generation follows the same steps as standard RSA key pair
generation with a couple of exceptions. The differences are that
AI_RSAMultiPrimeKeyGen must be used instead of AI_RSAKeyGen. Also, as indicated
in the Reference Manual entry for the appropriate AI, the algorithm chooser passed in
during the
B_GenerateInit call must include AM_RSA_MULTI_PRIME_KEY_GEN.
Step 1: Prepare A_RSA_MULTI_PRIME_KEY_GEN_PARAMS
Structure
To use AI_RSAMultiPrimeKeyGen in the call to B_SetAlgorithmInfo, we must first
prepare an A_RSA_MULTI_PRIME_KEY_GEN_PARAMS structure, which is defined
as follows:
The
numberOfPrimes field must be set to a value of 2 or more. If it is set to 2, it is
equivalent to generating a standard RSA key pair as is the case with
AI_RSAKeyGen. If
numberOfPrimes is set to 3 or more, the modulusBits field must be at least 1024.
Step 2: Set the Algorithm Object
If we have an algorithm object, keypairGenerator, which has already been created
with a call to
B_CreateAlgorithmObject, we can then set the algorithm object's info as
follows:
typedef struct {
unsigned int modulusBits;
unsigned int numberOfPrimes;
ITEM publicExponent;
} A_RSA_MULTI_PRIME_KEY_GEN_PARAMS;