
Functions | |
| WOLFSSL_API int | wc_Des_SetKey (Des *des, const byte *key, const byte *iv, int dir) |
| This function sets the key and initialization vector (iv) for the Des structure given as argument. It also initializes and allocates space for the buffers needed for encryption and decryption, if these have not yet been initialized. Note: If no iv is provided (i.e. iv == NULL) the initialization vector defaults to an iv of 0. More... | |
| WOLFSSL_API void | wc_Des_SetIV (Des *des, const byte *iv) |
| This function sets the initialization vector (iv) for the Des structure given as argument. When passed a NULL iv, it sets the initialization vector to 0. More... | |
| WOLFSSL_API int | wc_Des_CbcEncrypt (Des *des, byte *out, const byte *in, word32 sz) |
| This function encrypts the input message, in, and stores the result in the output buffer, out. It uses DES encryption with cipher block chaining (CBC) mode. More... | |
| WOLFSSL_API int | wc_Des_CbcDecrypt (Des *des, byte *out, const byte *in, word32 sz) |
| This function decrypts the input ciphertext, in, and stores the resulting plaintext in the output buffer, out. It uses DES encryption with cipher block chaining (CBC) mode. More... | |
| WOLFSSL_API int | wc_Des_EcbEncrypt (Des *des, byte *out, const byte *in, word32 sz) |
| This function encrypts the input message, in, and stores the result in the output buffer, out. It uses Des encryption with Electronic Codebook (ECB) mode. More... | |
| WOLFSSL_API int | wc_Des3_EcbEncrypt (Des3 *des, byte *out, const byte *in, word32 sz) |
| This function encrypts the input message, in, and stores the result in the output buffer, out. It uses Des3 encryption with Electronic Codebook (ECB) mode. Warning: In nearly all use cases ECB mode is considered to be less secure. Please avoid using ECB API’s directly whenever possible. More... | |
| WOLFSSL_API int | wc_Des3_SetKey (Des3 *des, const byte *key, const byte *iv, int dir) |
| This function sets the key and initialization vector (iv) for the Des3 structure given as argument. It also initializes and allocates space for the buffers needed for encryption and decryption, if these have not yet been initialized. Note: If no iv is provided (i.e. iv == NULL) the initialization vector defaults to an iv of 0. More... | |
| WOLFSSL_API int | wc_Des3_SetIV (Des3 *des, const byte *iv) |
| This function sets the initialization vector (iv) for the Des3 structure given as argument. When passed a NULL iv, it sets the initialization vector to 0. More... | |
| WOLFSSL_API int | wc_Des3_CbcEncrypt (Des3 *des, byte *out, const byte *in, word32 sz) |
| This function encrypts the input message, in, and stores the result in the output buffer, out. It uses Triple Des (3DES) encryption with cipher block chaining (CBC) mode. More... | |
| WOLFSSL_API int | wc_Des3_CbcDecrypt (Des3 *des, byte *out, const byte *in, word32 sz) |
| This function decrypts the input ciphertext, in, and stores the resulting plaintext in the output buffer, out. It uses Triple Des (3DES) encryption with cipher block chaining (CBC) mode. More... | |
| WOLFSSL_API int | wc_Des_CbcDecryptWithKey (byte *out, const byte *in, word32 sz, const byte *key, const byte *iv) |
| This function decrypts the input ciphertext, in, and stores the resulting plaintext in the output buffer, out. It uses DES encryption with cipher block chaining (CBC) mode. This function is a substitute for wc_Des_CbcDecrypt, allowing the user to decrypt a message without directly instantiating a Des structure. More... | |
| WOLFSSL_API int | wc_Des_CbcEncryptWithKey (byte *out, const byte *in, word32 sz, const byte *key, const byte *iv) |
| This function encrypts the input plaintext, in, and stores the resulting ciphertext in the output buffer, out. It uses DES encryption with cipher block chaining (CBC) mode. This function is a substitute for wc_Des_CbcEncrypt, allowing the user to encrypt a message without directly instantiating a Des structure. More... | |
| WOLFSSL_API int | wc_Des3_CbcEncryptWithKey (byte *out, const byte *in, word32 sz, const byte *key, const byte *iv) |
| This function encrypts the input plaintext, in, and stores the resulting ciphertext in the output buffer, out. It uses Triple DES (3DES) encryption with cipher block chaining (CBC) mode. This function is a substitute for wc_Des3_CbcEncrypt, allowing the user to encrypt a message without directly instantiating a Des3 structure. More... | |
| WOLFSSL_API int | wc_Des3_CbcDecryptWithKey (byte *out, const byte *in, word32 sz, const byte *key, const byte *iv) |
| This function decrypts the input ciphertext, in, and stores the resulting plaintext in the output buffer, out. It uses Triple Des (3DES) encryption with cipher block chaining (CBC) mode. This function is a substitute for wc_Des3_CbcDecrypt, allowing the user to decrypt a message without directly instantiating a Des3 structure. More... | |
| int wc_Des3_CbcDecrypt | ( | Des3 * | des, |
| byte * | out, | ||
| const byte * | in, | ||
| word32 | sz | ||
| ) |
This function decrypts the input ciphertext, in, and stores the resulting plaintext in the output buffer, out. It uses Triple Des (3DES) encryption with cipher block chaining (CBC) mode.
3
| des | pointer to the Des3 structure to use for decryption |
| out | pointer to the buffer in which to store the decrypted plaintext |
| in | pointer to the input buffer containing the encrypted ciphertext |
| sz | length of the ciphertext to decrypt |
Example
| WOLFSSL_API int wc_Des3_CbcDecryptWithKey | ( | byte * | out, |
| const byte * | in, | ||
| word32 | sz, | ||
| const byte * | key, | ||
| const byte * | iv | ||
| ) |
This function decrypts the input ciphertext, in, and stores the resulting plaintext in the output buffer, out. It uses Triple Des (3DES) encryption with cipher block chaining (CBC) mode. This function is a substitute for wc_Des3_CbcDecrypt, allowing the user to decrypt a message without directly instantiating a Des3 structure.
3
| out | pointer to the buffer in which to store the decrypted plaintext |
| in | pointer to the input buffer containing the encrypted ciphertext |
| sz | length of the ciphertext to decrypt |
| key | pointer to the buffer containing the 24 byte key to use for decryption |
| iv | pointer to the buffer containing the 8 byte iv to use for decryption. If no iv is provided, the iv defaults to 0 |
Example
| int wc_Des3_CbcEncrypt | ( | Des3 * | des, |
| byte * | out, | ||
| const byte * | in, | ||
| word32 | sz | ||
| ) |
This function encrypts the input message, in, and stores the result in the output buffer, out. It uses Triple Des (3DES) encryption with cipher block chaining (CBC) mode.
3
| des | pointer to the Des3 structure to use for encryption |
| out | pointer to the buffer in which to store the encrypted ciphertext |
| in | pointer to the input buffer containing the message to encrypt |
| sz | length of the message to encrypt |
Example
| WOLFSSL_API int wc_Des3_CbcEncryptWithKey | ( | byte * | out, |
| const byte * | in, | ||
| word32 | sz, | ||
| const byte * | key, | ||
| const byte * | iv | ||
| ) |
This function encrypts the input plaintext, in, and stores the resulting ciphertext in the output buffer, out. It uses Triple DES (3DES) encryption with cipher block chaining (CBC) mode. This function is a substitute for wc_Des3_CbcEncrypt, allowing the user to encrypt a message without directly instantiating a Des3 structure.
3
out Final encrypted data
| in | Data to be encrypted, must be padded to Des block size. |
| sz | Size of input buffer. |
| key | Pointer to the key to use for encryption. |
| iv | Initialization vector |
Example
| int wc_Des3_EcbEncrypt | ( | Des3 * | des, |
| byte * | out, | ||
| const byte * | in, | ||
| word32 | sz | ||
| ) |
This function encrypts the input message, in, and stores the result in the output buffer, out. It uses Des3 encryption with Electronic Codebook (ECB) mode. Warning: In nearly all use cases ECB mode is considered to be less secure. Please avoid using ECB API’s directly whenever possible.
3
\return 0 Returned upon successfully encrypting the given plaintext
| des3 | pointer to the Des3 structure to use for encryption |
| out | pointer to the buffer in which to store the encrypted message |
| in | pointer to the input buffer containing the plaintext to encrypt |
| sz | length of the plaintext to encrypt _Example_ /code Des3 enc; // Des3 structure used for encryptioninitialize enc with wc_Des3_SetKey, use mode DES_ENCRYPTION byte plain[] = { // initialize with message to encrypt };
byte cipher[sizeof(plain)];
if ( wc_Des3_EcbEncrypt(&enc,cipher, plain, sizeof(plain)) != 0) {
error encrypting message } /endcode |
| int wc_Des3_SetIV | ( | Des3 * | des, |
| const byte * | iv | ||
| ) |
This function sets the initialization vector (iv) for the Des3 structure given as argument. When passed a NULL iv, it sets the initialization vector to 0.
3
| des | pointer to the Des3 structure for which to set the iv |
| iv | pointer to the buffer containing the 8 byte iv with which to initialize the Des3 structure. If this is not provided, the iv defaults to 0 |
Example
| int wc_Des3_SetKey | ( | Des3 * | des, |
| const byte * | key, | ||
| const byte * | iv, | ||
| int | dir | ||
| ) |
This function sets the key and initialization vector (iv) for the Des3 structure given as argument. It also initializes and allocates space for the buffers needed for encryption and decryption, if these have not yet been initialized. Note: If no iv is provided (i.e. iv == NULL) the initialization vector defaults to an iv of 0.
3
| des3 | pointer to the Des3 structure to initialize |
| key | pointer to the buffer containing the 24 byte key with which to initialize the Des3 structure |
| iv | pointer to the buffer containing the 8 byte iv with which to initialize the Des3 structure. If this is not provided, the iv defaults to 0 |
| dir | direction of encryption. Valid options are: DES_ENCRYPTION, and DES_DECRYPTION |
Example
| int wc_Des_CbcDecrypt | ( | Des * | des, |
| byte * | out, | ||
| const byte * | in, | ||
| word32 | sz | ||
| ) |
This function decrypts the input ciphertext, in, and stores the resulting plaintext in the output buffer, out. It uses DES encryption with cipher block chaining (CBC) mode.
3
| des | pointer to the Des structure to use for decryption |
| out | pointer to the buffer in which to store the decrypted plaintext |
| in | pointer to the input buffer containing the encrypted ciphertext |
| sz | length of the ciphertext to decrypt |
Example
| WOLFSSL_API int wc_Des_CbcDecryptWithKey | ( | byte * | out, |
| const byte * | in, | ||
| word32 | sz, | ||
| const byte * | key, | ||
| const byte * | iv | ||
| ) |
This function decrypts the input ciphertext, in, and stores the resulting plaintext in the output buffer, out. It uses DES encryption with cipher block chaining (CBC) mode. This function is a substitute for wc_Des_CbcDecrypt, allowing the user to decrypt a message without directly instantiating a Des structure.
3
| out | pointer to the buffer in which to store the decrypted plaintext |
| in | pointer to the input buffer containing the encrypted ciphertext |
| sz | length of the ciphertext to decrypt |
| key | pointer to the buffer containing the 8 byte key to use for decryption |
| iv | pointer to the buffer containing the 8 byte iv to use for decryption. If no iv is provided, the iv defaults to 0 |
Example
| int wc_Des_CbcEncrypt | ( | Des * | des, |
| byte * | out, | ||
| const byte * | in, | ||
| word32 | sz | ||
| ) |
This function encrypts the input message, in, and stores the result in the output buffer, out. It uses DES encryption with cipher block chaining (CBC) mode.
3
| des | pointer to the Des structure to use for encryption |
| out | pointer to the buffer in which to store the encrypted ciphertext |
| in | pointer to the input buffer containing the message to encrypt |
| sz | length of the message to encrypt |
Example
| WOLFSSL_API int wc_Des_CbcEncryptWithKey | ( | byte * | out, |
| const byte * | in, | ||
| word32 | sz, | ||
| const byte * | key, | ||
| const byte * | iv | ||
| ) |
This function encrypts the input plaintext, in, and stores the resulting ciphertext in the output buffer, out. It uses DES encryption with cipher block chaining (CBC) mode. This function is a substitute for wc_Des_CbcEncrypt, allowing the user to encrypt a message without directly instantiating a Des structure.
3
| out | Final encrypted data |
| in | Data to be encrypted, must be padded to Des block size. |
| sz | Size of input buffer. |
| key | Pointer to the key to use for encryption. |
| iv | Initialization vector |
Example
| int wc_Des_EcbEncrypt | ( | Des * | des, |
| byte * | out, | ||
| const byte * | in, | ||
| word32 | sz | ||
| ) |
This function encrypts the input message, in, and stores the result in the output buffer, out. It uses Des encryption with Electronic Codebook (ECB) mode.
3
| des | pointer to the Des structure to use for encryption |
| out | pointer to the buffer in which to store the encrypted message |
| in | pointer to the input buffer containing the plaintext to encrypt |
| sz | length of the plaintext to encrypt |
Example
| void wc_Des_SetIV | ( | Des * | des, |
| const byte * | iv | ||
| ) |
This function sets the initialization vector (iv) for the Des structure given as argument. When passed a NULL iv, it sets the initialization vector to 0.
3
| des | pointer to the Des structure for which to set the iv |
| iv | pointer to the buffer containing the 8 byte iv with which to initialize the Des structure. If this is not provided, the iv defaults to 0 |
Example
| int wc_Des_SetKey | ( | Des * | des, |
| const byte * | key, | ||
| const byte * | iv, | ||
| int | dir | ||
| ) |
This function sets the key and initialization vector (iv) for the Des structure given as argument. It also initializes and allocates space for the buffers needed for encryption and decryption, if these have not yet been initialized. Note: If no iv is provided (i.e. iv == NULL) the initialization vector defaults to an iv of 0.
3
| des | pointer to the Des structure to initialize |
| key | pointer to the buffer containing the 8 byte key with which to initialize the Des structure |
| iv | pointer to the buffer containing the 8 byte iv with which to initialize the Des structure. If this is not provided, the iv defaults to 0 |
| dir | direction of encryption. Valid options are: DES_ENCRYPTION, and DES_DECRYPTION |
Example