RSAGenerate

Generates key components for the desired RSA cryptographic system.

Syntax

IppStatus ippsRSAGenerate(IppsBigNumState* pE, int nBitsN, int nBitsP, int nTrials, IppsRSAState* pCtx, IppBitSupplier rndFunc, void* pRndParam);

Parameters

pE

Pointer to the IppsBigNumState context of the newly generated RSA public exponent key.

nBitsN

Length of the RSA system in bits (that is, the length of the composite RSA modulus n in bits).

nBitsP

Length in bits of one of the two prime factors of the RSA modulus.

nTrials

Security parameter specified for the Miller-Rabin probable primality.

pCtx

Pointer to the IppsRSAState context.

rndFunc

Pseudorandom number generator.

pRndParam

Pointer to the context of the pseudorandom number generator.

Description

The function is declared in the ippcp.h file. This function generates the desired RSA cryptographic system based on the following data:

This function sequentially performs the following computations:

  1. Generates random probable prime numbers p and q using the specified pseudorandom number generator rndFunc.

  2. Computes the RSA composite modulus n = (p*q) and the RSA private exponent d.
  3. Computes all other CRT-related RSA components.

To generate RSA keys using the RSAGenerate function, call it in the following sequence of steps:


  1. Establish the pseudorandom number generator.

  2. Define the size of the RSA cryptosystem, that is, lengths nBitsN and nBitsP of n and p (in bits), respectively.

  3. Define the RSA cryptosystem using the IppRSAprivate flag. To do this, use the following function calls:

    ippsRSAGetSize(nBitsN, nBitsP, IppRSAprivate, &rsaCtxSize);

    ippsRSAInit(nBitsN, nBitsP, IppRSAprivate, pCtx);

    where pCtx is the memory allocated for the RSA context.

  4. Define the initial value of the public key E and make the call

    ippsRSAGenerate(pE, nBitsN, nBitsP, nTrials, pCtx, rndFunc, pRndParam);

    If ippsRSAGenerate returns IppNoErr, keys are generated.

    If ippsRSAGenerate returns ippStsInsufficientEntropy, repeat this step from the beginning.

    Note iconNote

    ippsRSAGenerate may change the initial value of the public key E.

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or warning.

ippStsNullPtrErr

Indicates an error condition if any of the specified pointers is NULL.

ippStsContextMatchErr

Indicates an error condition if the context parameter does not match the operation.

ippStsNotSupportedModeErr

Indicates an error condition if RSA context was initialized with the IppRSApublic flag.

ippStsBadArgErr

Indicates an error condition in cases not explicitly mentioned above.

ippStsInsufficientEntropy

Indicates a warning condition if prime generation fails due to poor choice of entropy.

See Also


Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.