|
Mixe for Privacy and Anonymity in the Internet
|
This class could be used for encryption/decryption of data (streams) with AES using 128bit CBC mode. More...
#include <CASymCipher.hpp>
Public Member Functions | |
| CASymCipher () | |
| ~CASymCipher () | |
| bool | isKeyValid () |
| SINT32 | setKey (const UINT8 *key) |
| Sets the key for encryption. More... | |
| SINT32 | setKey (const UINT8 *key, bool bEncrypt) |
| Sets the keys for crypt1() and crypt2() either to the same key (if keysize==KEY_SIZE) or to different values, if keysize==2* KEY_SIZE. More... | |
| SINT32 | setIV (const UINT8 *p_iv) |
| Sets iv to p_iv. More... | |
| SINT32 | decryptCBCwithPKCS7 (const UINT8 *in, UINT8 *out, UINT32 *len) |
| En-/Decryptes in to out using iv1 and key1. More... | |
| SINT32 | encryptCBCwithPKCS7 (const UINT8 *in, UINT32 inlen, UINT8 *out, UINT32 *len) |
| En-/Decryptes in to out using IV1 and key1. More... | |
Public Member Functions inherited from CALockAble | |
| CALockAble () | |
| virtual | ~CALockAble () |
| SINT32 | lock () |
| Locks the lockable object by threadsafe incrementing a reference counter. More... | |
| SINT32 | unlock () |
| Unlocks the lockable object by threadsafe decrementing a reference counter. More... | |
Protected Attributes | |
| AES_KEY * | m_keyAES1 |
| UINT8 * | m_iv1 |
| bool | m_bKeySet |
Private Attributes | |
| CAMutex * | m_pcsEnc |
| CAMutex * | m_pcsDec |
Additional Inherited Members | |
Protected Member Functions inherited from CALockAble | |
| SINT32 | waitForDestroy () |
| If called checks if the reference counter equals zero. More... | |
This class could be used for encryption/decryption of data (streams) with AES using 128bit CBC mode.
Definition at line 38 of file CASymCipher.hpp.
|
inline |
Definition at line 44 of file CASymCipher.hpp.
References m_bKeySet, m_iv1, m_keyAES1, m_pcsDec, and m_pcsEnc.
|
inline |
Definition at line 63 of file CASymCipher.hpp.
References m_iv1, m_keyAES1, m_pcsDec, m_pcsEnc, and CALockAble::waitForDestroy().
En-/Decryptes in to out using iv1 and key1.
AES is used for en-/dcryption and the cryption is done with CBC mode and PKCS7 padding.
| in | input (plain or ciphertext) bytes |
| out | output (plain or ciphertext) bytes |
| len | len of input. on return the output len, which is always <= len of input |
| E_SUCCESS | |
| E_UNKNOWN,if | error |
Definition at line 134 of file CASymCipher.cpp.
References E_SUCCESS, E_UNKNOWN, len, m_iv1, and m_keyAES1.
Referenced by decryptXMLElement().
| SINT32 CASymCipher::encryptCBCwithPKCS7 | ( | const UINT8 * | in, |
| UINT32 | inlen, | ||
| UINT8 * | out, | ||
| UINT32 * | len | ||
| ) |
En-/Decryptes in to out using IV1 and key1.
AES is used for en-/decryption and the cryption is done with CBC mode and PKCS7 padding.
| in | input (plain or ciphertext) bytes |
| inlen | size of the input buffer |
| out | output (plain or ciphertext) bytes |
| len | on call len of output buffer; on return size of output buffer used, which is always > len of input |
| E_SUCCESS |
Definition at line 166 of file CASymCipher.cpp.
References E_SPACE, E_SUCCESS, len, m_iv1, and m_keyAES1.
Referenced by encryptXMLElement().
|
inline |
Sets iv to p_iv.
| p_iv | 16 random bytes used for new iv1 and iv2. |
| E_SUCCESS |
Definition at line 103 of file CASymCipher.hpp.
References E_SUCCESS, and m_iv1.
Referenced by decryptXMLElement(), and encryptXMLElement().
Sets the key for encryption.
Sets the key1 and key2 used for encryption/decryption.
Also resets the IVs to zero!
| key | 16 random bytes used as key |
| E_SUCCESS |
Definition at line 52 of file CASymCipher.cpp.
Referenced by decryptXMLElement(), encryptXMLElement(), CAFirstMixB::loop(), and CALastMixB::loop().
Sets the keys for crypt1() and crypt2() either to the same key (if keysize==KEY_SIZE) or to different values, if keysize==2* KEY_SIZE.
Sets the key1 and key2 used for encryption/decryption to the same value of key.
Also resets the IVs to zero!
| key | 16 random bytes used as key |
| bEncrypt | if true, the key should be used for encryption (otherwise it will be used for decryption) |
| E_SUCCESS |
Definition at line 62 of file CASymCipher.cpp.
|
protected |
Definition at line 129 of file CASymCipher.hpp.
Referenced by CASymCipher(), isKeyValid(), and setKey().
|
protected |
Definition at line 128 of file CASymCipher.hpp.
Referenced by CASymCipher(), decryptCBCwithPKCS7(), encryptCBCwithPKCS7(), setIV(), setKey(), and ~CASymCipher().
|
protected |
Definition at line 123 of file CASymCipher.hpp.
Referenced by CASymCipher(), decryptCBCwithPKCS7(), encryptCBCwithPKCS7(), setKey(), and ~CASymCipher().
|
private |
Definition at line 116 of file CASymCipher.hpp.
Referenced by CASymCipher(), and ~CASymCipher().
|
private |
Definition at line 115 of file CASymCipher.hpp.
Referenced by CASymCipher(), and ~CASymCipher().