Apps Components Interfaces All Files Source Tree | source: tos.interfaces.BlockCipherMode.nc |
Presents an encryption mode interface on type of the BlockCipher interface. Typical modes include CBC, OFB, BC. In general, this interface should be used for encryption over the BlockCipher interface since encrypting the same data (using different IV's) using any of the above modes will produce different ciphertexts.
Author: | Naveen Sastry |
Commands |
Commands - Details |
Parameters: |
context - holds the module specific opaque data related to the key (perhaps key expansions) and other internal state plainText - an array of at least blockSize bytes. cipherText - an array of equal size to the plainText which will hold the results of the encryption; may be the plainText array. numBytes - number of data bytes to encrypt. IV - an array of the initialization vector. It should be of blockSize bytes |
Returns: | Whether the encryption was successful. Possible failure reasons include not calling init() or an incorrectly sized plain-text array. |
Parameters: |
context - holds the module specific opaque data related to the key (perhaps key expansions) and other internal state. cipherText - an array of at lest blockSize bytes which contains encrypted data using the key from the init phase. plainText - an array of equal size to the cipherText which will hold the results of the decryption. may be the cipherText array. numBytes - number of data bytes to decrypt. IV - an array of the initialization vector. It should be of blockSize bytes |
Returns: | Whether the decryption was successful. Possible failure reasons include not calling init() or an incorrectly sized cipher-text array. |
Parameters: |
context - holds the module specific opaque data related to the key (perhaps key expansions) and other internal state. IV - The initialization vector that was used to encrypt this particular data stream. This array must have a length equal to one block size. The - exact length of the data stream in bytes; this must be at least the underlying block cipher size. |
Returns: | Whether the initialization was successful. Possible failure reasons include not calling init() or an underlying failure in the block cipher. |
Parameters: |
context - holds the module specific opaque data related to the key (perhaps key expansions) and other internal state. ciphertext - Pointer to the start of the next ciphertext buffer. plaintext - Pointer to the start of the buffer which is large enough to hold the entire ciphertext. This buffer must be passed in every time to the incrementalDecrypt function. After this call, done bytes of the plaintext buffer will be available for consumption. length - The number of bytes that is being provided in the ciphertext done - A pointer to an int which will be filled in after the call completes with the number of bytes of plaintext which is available. |
Returns: | Whether the call was successful or not. Possible failure reasons include not calling init(), an underlying failure in the block cipher, or providing more ciphertext than is expected. |