A SERVICE OF

logo

Block Ciphers
196 RSA BSAFE Crypto-C Developers Guide
Decrypting
As in the Introductory Example on page 9, decrypting is similar to encrypting. Use
the same AI, IV, and key data. Use the proper decrypting AM and call
B_DecryptInit,
B_DecryptUpdate, and B_DecryptFinal.
The RC6 Cipher
The RC6 cipher was developed by Ronald Rivest and Matthew Robshaw, Ray Sidney,
and Lisa Yin of RSA Laboratories West as a candidate for the Advanced Encryption
Standard (AES). RC6 allows for a variable number of rounds; however, the
implementation in this version of Crypto-C fixes the number of rounds at 20. Later
versions of Crypto-C may extend this value.
The example in this section corresponds to the file
rc6.c, which uses AI_RC6_CBCPad.
AI_FeedbackCipher also supports the RC6 symmetric block cipher.
AI_FeedbackCipher is useful if your application has a need to support block cipher
modes other than CBC. See the
rc6fb.c sample program for more information.
Step 1: Create
Declare a variable to be B_ALGORITHM_OBJ and as defined in the function prototype in
Chapter 4 of the Reference Manual, its address is the argument for
B_CreateAlgorithmObject.
Step 2: Set
For this example, you will perform an RC6 operation in CBC mode using PKCS V#5
padding. To do this, use
AI_RC6_CBCPad in the call to B_SetAlgorithmInfo. Notice
if (encryptedData != NULL_PTR) {
T_memset (encryptedData, 0, encryptedDataLen);
T_free (encryptedData);
encryptedData = NULL_PTR;
}
B_ALGORITHM_OBJ rc6Encrypter = (B_ALGORITHM_OBJ)NULL_PTR;
if ((status = B_CreateAlgorithmObject (&rc6Encrypter)) != 0)
break;