Sets the crypting operation mode. Possible values are CRYPT_OP_ECB, CRYPT_OP_CBC and CRYPT_OP_CTS.
nMode |
Operation mode name |
Minimal result size |
CRYPT_OP_ECB *) |
Electronic CodeBook |
one block |
CRYPT_OP_CBC |
Cipher Block Chaining |
two blocks |
CRYPT_OP_CTS |
CBC combined with cipher text stealing |
two blocks |
For the modes CRYPT_OP_CBC and CRYPT_OP_CTS an initialization vector (IV) is required. By default (CRYPT_AUTO_LEADING_IV), an initialization vector is
generated automatically and encrypted. This IV is then contained in the first 16 bytes of the encrypted message. For decryption, the encrypted IV is expected
in the first 16 bytes of the encrypted message, too. A sub-mode can optionally be specified for controlling the generation and placement of the IV by
adding one of the values from the following table. Hence, an <nMode> parameter of CRYPT_OP_CBC+CRYPT_AUTO_LEADING_IV defines Cipher Block Chaining with a leading IV which is automatically generated.
nMode |
Description |
CRYPT_AUTO_LEADING_IV *) |
Automatically generated IV, precedes encrypted message. |
CRYPT_AUTO_TRAILING_IV |
Automatically generated IV, follows encrypted message. |
CRYPT_CUSTOM_LEADING_IV |
<cIV> parameter used, precedes encrypted message. |
CRYPT_CUSTOM_TRAILING_IV |
<cIV> parameter used, follows encrypted message. |
CRYPT_AUTO_LEADING_IV: The initialization vector is chosen automatically and randomly for encryption. After encryption, the IV is contained in the first 16 bytes of the encrypted
message. For decryption the IV is expected in the first 16 bytes of the encrypted message.
CRYPT_AUTO_TRAILING_IV: The initialization vector is chosen automatically and randomly for the encryption. After encryption, the IV is contained in the last 16 bytes of the
encrypted message. For decryption the IV is expected in the last 16 bytes of the encrypted message.
CRYPT_CUSTOM_LEADING_IV: For encryption the initialization vector is passed in the parameter cIV and is contained in the first 16 bytes of the encrypted message. For decryption the IV is expected in the first 16 bytes of the encrypted message.
CRYPT_CUSTOM_TRAILING_IV: For encryption the initialization vector is passed in the parameter cIV and is contained in the last 16 bytes of the encrypted message. For decryption the IV is expected in the last 16 bytes of the encrypted message.