The functions described in this section refer to RSA primitives.
The application code for conducting a typical RSA encryption must perform the following sequence of operations, starting with building of a crypto system:
- Call the function
RSA_GetSizePublicKey to get the size required to configure
IppsRSAPublicKeyState context.
- Ensure that the required memory space is properly allocated. With the allocated memory, call the
RSA_InitPublicKey function to initialize the context.
- Call
RSA_SetPublicKey to set up RSA public key (n,
e).
- Call the
RSA_GetBufferSizePublicKey function to get the size of a temporary buffer.
- Invoke the
RSA_Encrypt function with the established RSA public key to encode the plaintext into the respective ciphertext.
- Clean up secret data stored in the context.
- Free the memory allocated for the
IppsRSAPublicKeyState context by calling the operating system memory free service function.
The typical application code for the RSA decryption must perform the following sequence of operations:
- Call the function
GetSizePrivateKeyType1 or
RSA_GetSizePrivateKeyType2 to get the size required to configure
IppsRSAPrivateKeyState context.
- Ensure that the required memory space is properly allocated. With the allocated memory, call the
InitPrivateKeyType1 or
RSA_InitPrivateKeyType2 function to initialize the context.
- Call the
RSA_GetBufferSizePrivateKey function to get the size of a temporary buffer.
- Establish the RSA private key by means of either the
RSA_GenerateKeys function or by the key setup function
RSA_SetPrivateKeyType1 or
RSA_SetPrivateKeyType2.
The
RSA_GenerateKeys function can generate both type 1 and type 2 private keys, while the choice of the key setup function depends on the representation of the private key you are using.
- Invoke the
RSA_Decrypt function with the established RSA public key to decode the ciphertext into the respective plaintext.
- Clean up secret data stored in the context.
- Free the memory allocated for the
IppsRSAPrivateKeyState context by calling the operating system memory free service function.
You can perform up to 8 encryption/decryption operations at once using the
RSA_MB_Encrypt and
RSA_MB_Decrypt functions. For this, repeat steps 2-4 to set up the required number of keys, and then repeat steps 6-7 for each initialized context.