RSA Security 5 manual AIRSAPrivate, RSA algorithm for performing raw private-key encryption

Models: 5

1 376
Download 376 pages 51.16 Kb
Page 220
Image 220

AI_RSAPrivate

AI_RSAPrivate

Purpose:

This AI allows you to encrypt data using the raw RSA algorithm. You can find the description of this algorithm in B. Schneier's Applied Cryptography.

AI_RSAPrivate is different from AI_PKCS_RSAPrivate because the former allows you to encrypt raw data, while the latter encrypts data in PKCS #1 format.

Because this algorithm does not pad, the total number of input bytes must be a multiple of the key’s modulus size in bytes. Your application is responsible for padding the data as appropriate. Also, each modulus-size block of input, interpreted as an integer with the most significant byte first, must be numerically less than the key’s modulus. To do this, divide your data into blocks that are one byte smaller than the modulus, and prepend one byte of zeros to each block.

To perform RSA encryption you can also use AI_PKCS_RSAPrivate and

AI_SET_OAEP_RSAPrivate. But you can use AI_RSAPrivate only if the data will be decrypted with AI_RSAPublic.

Type of information this allows you to use:

the RSA algorithm for performing raw private-key encryption.

Format of info supplied to B_SetAlgorithmInfo:

NULL_PTR.

Format of info returned by B_GetAlgorithmInfo:

NULL_PTR.

Crypto-C procedures to use with algorithm object:

B_EncryptInit, B_EncryptUpdate, B_EncryptFinal, B_DecryptInit,

B_DecryptUpdate, and B_DecryptFinal. You may pass (B_ALGORITHM_OBJ)NULL_PTR for all randomAlgorithm arguments.

2 1 0

R S A B S A F E C r y p t o - C L i b r a r y R e f e r e n c e M a n u a l

Page 220
Image 220
RSA Security 5 manual AIRSAPrivate, RSA algorithm for performing raw private-key encryption