Back to product page
CryptoModes Enumeration
The following modes define how encryption algorithms transform sequences of data blocks.
Remarks
The default value is ECB.Electronic CodeBook Mode (ECB)
The obvious way of using an algorithm is simply to apply it directly to plaintext, transforming each 64-bit block of plaintext individually. Identical blocks of plaintext are transformed to identical blocks of ciphertext.
Cipher Block Chaining (CBC)
CBC (standing for Cipher Block Chaining) is one of the most popular modes. It addresses the first of the two problems with ECB mode. Before being encrypted normally (as in ECB mode) each plaintext block is XORed with the previous ciphertext block. The first plaintext block is XORed with a random 64-bit block, called the initialization vector, which is transmitted in the clear.
You should set the InitVector property when this mode is used.
Output FeedBack (OFB)
OFB (standing for Output FeedBack) addresses both the first and second problems noted earlier that exist with ECB mode. An initialization vector is again sent in the clear. It is repeatedly encrypted by the algorithm, and the result of doing so is XORed with successive blocks of the plaintext.
This mode has two problems of its own. The plaintext itself is only subjected to an XOR. This means that if the plaintext is known, another plaintext can be substituted by inverting the same bits of the ciphertext as one would need to invert of the plaintext to do so. This is called a bit-flipping attack. And there is always the possibility, albeit a slim one, that one might choose a key and an initialization vector such that the successive blocks generated might repeat in a short loop.
You should set the InitVector property when this mode is used.
Cipher FeedBack (CFB)
A mode which seems to avoid most of the problems so far encountered is CFB (for Cipher FeedBack). Here, a plaintext block is enciphered by being XORed to the algorithm encryption of the previous ciphertext block. For the first plaintext block, an initialization vector again takes the role of the first plaintext block.
This mode has variants that involve performing algorithm encryptions more often, such as once for each bit or byte. Some problems have been claimed with these variants, and they require more computation without increasing security.
One other mode among those originally suggested for use with algorithm was Output Feedback Mode (OFB): this mode encrypted an initial value with the algorithm, and then the result of the encryption was encrypted again repeatedly. The resulting values were used as a keystream to XOR with messages.
This mode is not often used, because of concerns that one might accidentally choose a starting value that led to a short cycle.
You should set InitVector property when this mode is used.
Possible values for CryptoModes:
Constant | Value | Description |
---|---|---|
ECB | 0 | Electronic CodeBook Mode |
CBC | 1 | Cipher Block Chaining Mode |
CFB | 2 | Cipher FeedBack Mode |
OFB | 3 | Output FeedBack Mode |