RSA Primitives
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 functionRSA_GetSizePublicKeyto get the size required to configureIppsRSAPublicKeyStatecontext.
- Ensure that the required memory space is properly allocated. With the allocated memory, call theRSA_InitPublicKeyfunction to initialize the context.
- Call theRSA_GetBufferSizePublicKeyfunction to get the size of a temporary buffer.
- Invoke theRSA_Encryptfunction 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 theIppsRSAPublicKeyStatecontext 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 functionGetSizePrivateKeyType1orRSA_GetSizePrivateKeyType2to get the size required to configureIppsRSAPrivateKeyStatecontext.
- Ensure that the required memory space is properly allocated. With the allocated memory, call theInitPrivateKeyType1orRSA_InitPrivateKeyType2function to initialize the context.
- Call theRSA_GetBufferSizePrivateKeyfunction to get the size of a temporary buffer.
- Establish the RSA private key by means of either theRSA_GenerateKeysfunction or by the key setup functionRSA_SetPrivateKeyType1orRSA_SetPrivateKeyType2.The.RSA_GenerateKeysfunction 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 theRSA_Decryptfunction 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 theIppsRSAPrivateKeyStatecontext 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.