Mixes 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...
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.
CASymCipher::~CASymCipher | ( | ) |
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 |
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 |
References E_SPACE, E_SUCCESS, len, m_iv1, and m_keyAES1.
Referenced by encryptXMLElement().
bool CASymCipher::isKeyValid | ( | ) |
References m_bKeySet.
Sets iv to p_iv.
p_iv | 16 random bytes used for new iv1 and iv2. |
E_SUCCESS |
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 |
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 |
|
protected |
Referenced by CASymCipher(), isKeyValid(), and setKey().
|
protected |
Referenced by CASymCipher(), decryptCBCwithPKCS7(), encryptCBCwithPKCS7(), setIV(), setKey(), and ~CASymCipher().
|
protected |
Referenced by CASymCipher(), decryptCBCwithPKCS7(), encryptCBCwithPKCS7(), setKey(), and ~CASymCipher().
|
private |
Referenced by CASymCipher(), and ~CASymCipher().
|
private |
Referenced by CASymCipher(), and ~CASymCipher().