This API creates an AES encryption key based on supplied key material.
The AES (Advanced Encryption Standard) key size is selected by the
caller's key->keyBits
value. The key->keyDataPtr
must be set to reference the key material (usually some randomly selected
values). The same key material must be used for both this
Crypt_AES_MakeEncryptKey()
and the
Crypt_AES_MakeDecryptKey() in order
for a given message to be succesfully encrypted and decrypted.
The amount of key material provided must cover the key size. So this
means that for a 128 bit key, 16 bytes of key material are required. For
192 bit key, 24 bytes are required. And for a 256 bit key, 32 bytes are
required.
The object referenced by the aescontext
argument, while
allocated by the user, is used only by the AES API to maintain the
key state information. The user should ignore this object's
contents. No particular preset is required on it by the user.
The AES cipher encryption/decryption speed improves slightly (~4%) when the
Crypt_AES_Context
object is allocated from the system's
fast RAM heap area. Go
here for a summary of
cipher method execution times.