Block Ciphers

typedef struct {

 

 

unsigned char *encryptionMethodName;

/* examples include “des”, “rc5” */

POINTER

encryptionParams;

/* e.g., RC5 parameters */

unsigned char *feedbackMethodName;

 

POINTER

feedbackParams;

/* Points at init vector ITEM */

 

 

/* for all feedback modes except cfb */

unsigned char *paddingMethodName;

 

POINTER

paddingParams;

/* Ignored for now, but may be used */

 

 

/* for new padding schemes */

} B_BLK_CIPHER_W_FEEDBACK_PARAMS;

 

 

 

 

encryptionMethodName is the block cipher that you will use; for this example, use “des”. The information in the Reference Manual indicates that you do not need to supply any parameters for the DES encryption algorithm, so set encryptionParams to NULL_PTR.

Use Cipher Block Chaining (CBC) for your feedback method. For this method, the Reference Manual says that feedbackParams is an ITEM structure containing the initialization vector:

typedef struct { unsigned char *data; unsigned int len;

}ITEM;

See “Block Ciphers” on page 37 for an explanation of initialization vectors. Use a random number generator to produce an IV. Remember, the IV is not secret and will not assist anyone in breaking the encryption, but you should use a different IV for different messages. The size of the IV is eight bytes, because DES encrypts blocks of eight bytes. The size of the IV is always related to the size of the block, not the key:

unsigned char *ivBytes[BLOCK_SIZE];

B_BLK_CIPHER_W_FEEDBACK_PARAMS fbParams;

ITEM ivItem;

C h a p t e r 6 S y m m e t r i c - K e y O p e r a t i o n s

1 7 9

Page 201
Image 201
RSA Security 5.2.2 manual Examples include des, rc5, RC5 parameters, Points at init vector Item, For new padding schemes