A SERVICE OF

logo

AI_RC4WithMAC
192 RSA BSAFE Crypto-C Library Reference Manual
AI_RC4WithMAC
Purpose:
This AI implements a stream cipher with a simple tamper-detection message
authentication code based on
AI_MAC. When applied to a plaintext buffer of n bytes, it
produces a ciphertext of
n bytes using the same algorithm as AI_RC4, and then it
appends a MAC of
macLen bytes. You can find a description of AI_RC4 in B. Schneier's
Applied Cryptography
. For more information about
AI_MAC, see page 96.
Type of information this allows you to use:
the RC4 With MAC encryption algorithm. The MAC is computed using AI_MAC by
first passing the key to
AI_MAC, then the plaintext, and finally a block of macLen zero
bytes. The resulting value from
AI_MAC is appended to the ciphertext. For decryption,
the MAC value is checked.
The key passed to both
AI_RC4 and AI_MAC is created by appending the salt bytes to
the end of the key passed to
B_EncryptInit or B_DecryptInit. That is, for this AI, the
RC4 key depends on the salt as well as the key object passed to the
Init routine.
Format of info supplied to B_SetAlgorithmInfo:
pointer to a B_RC4_WITH_MAC_PARAMS structure:
The
salt
ITEM supplies the salt value that is appended to the key, where the ITEM’s
data
points to an unsigned byte array and the ITEM’s
len
gives its length. If the length
is zero, no salt is appended to the key, and the
ITEM’s
data
is ignored.
macLen
has a
minimum of 2 and maximum of 16.
Format of info returned by B_GetAlgorithmInfo:
pointer to a B_RC4_WITH_MAC_PARAMS structure (see above).
typedef struct {
ITEM salt; /* variable-length salt */
unsigned int macLen; /* length to use for MAC value */
} B_RC4_WITH_MAC_PARAMS;