Mixes for Privacy and Anonymity in the Internet
|
Public Member Functions | |
CAASymCipher () | |
~CAASymCipher () | |
SINT32 | destroy () |
SINT32 | decrypt (const UINT8 *from, UINT8 *to) |
Decrypts exactly one block which is stored in from . More... | |
SINT32 | decryptOAEP (const UINT8 *from, UINT8 *to, UINT32 *len) |
Decrypts one OAEP encoded block which is stored in from . More... | |
SINT32 | encrypt (const UINT8 *from, UINT8 *to) |
Encrypts exactly one block which is stored in from . More... | |
SINT32 | encryptOAEP (const UINT8 *from, UINT32 fromlen, UINT8 *to, UINT32 *len) |
Encrypts one block of plain text using OAEP padding. More... | |
SINT32 | encryptPKCS1 (const UINT8 *from, UINT32 fromlen, UINT8 *to, UINT32 *len) |
Encrypts one block of plain text using PKCS1 padding. More... | |
SINT32 | generateKeyPair (UINT32 size) |
Generates a new random key-pair of size bits. More... | |
SINT32 | getPublicKeyAsDOMElement (DOMElement *&elemRoot, XERCES_CPP_NAMESPACE::DOMDocument *docOwner) |
SINT32 | getPublicKeyAsXML (UINT8 *buff, UINT32 *len) |
Stores the public key in buff . More... | |
SINT32 | setPublicKey (const CACertificate *pCert) |
Sets the public key which is used for encryption to the contained in the provided certificate. More... | |
SINT32 | setPublicKeyAsXML (const UINT8 *buff, UINT32 len) |
Sets the public key to the values stored in key . More... | |
SINT32 | setPublicKeyAsDOMNode (DOMNode *node) |
SINT32 | setPublicKey (const UINT8 *modulus, UINT32 moduluslen, const UINT8 *exponent, UINT32 exponentlen) |
Static Public Member Functions | |
static SINT32 | testSpeed () |
Private Member Functions | |
SINT32 | addKeyPart (DOMElement *elemRoot, XERCES_CPP_NAMESPACE::DOMDocument *docOwner, const char *partName, BIGNUM *part) |
SINT32 | getKeyPart (BIGNUM **part, DOMNode *node) |
Private Attributes | |
RSA * | m_pRSA |
CAASymCipher::CAASymCipher | ( | ) |
References m_pRSA.
Referenced by testSpeed().
CAASymCipher::~CAASymCipher | ( | ) |
References destroy().
|
private |
References createDOMElement(), createDOMText(), E_SUCCESS, and CABase64::encode().
Referenced by getPublicKeyAsDOMElement().
Decrypts exactly one block which is stored in from
.
The result of the decryption is stored in to
.
from | one block of cipher text |
to | the decrypted plain text |
E_UNKNOWN | in case of an error |
E_SUCCESS | otherwise |
References E_SUCCESS, E_UNKNOWN, m_pRSA, and RSA_SIZE.
Referenced by decodeXMLEncryptedKey(), and CALastMixB::loop().
Decrypts one OAEP encoded block which is stored in from
.
from | one OAEP encoded block of cipher text |
to | the plain text |
len | on return contains the size of the plaintext |
E_UNKNOWN | in case of an error |
E_SUCCESS | otherwise |
References E_SUCCESS, E_UNKNOWN, len, m_pRSA, and RSA_SIZE.
Referenced by decryptXMLElement(), CALastMixA::loop(), and testSpeed().
SINT32 CAASymCipher::destroy | ( | ) |
References E_SUCCESS, and m_pRSA.
Referenced by ~CAASymCipher().
Encrypts exactly one block which is stored in from
.
The result of the encrpytion is stored in to
.
from | one block of plain text |
to | the encrypted cipher text |
E_UNKNOWN | in case of an error |
E_SUCCESS | otherwise |
References E_SUCCESS, E_UNKNOWN, m_pRSA, and RSA_SIZE.
Referenced by __encryptKey(), CALocalProxy::loop(), CAMsg::openEncryptedLog(), and CALocalProxy::processKeyExchange().
Encrypts one block of plain text using OAEP padding.
from | pointer to one block of plain text |
fromlen | size of the plain text |
to | the OAEP encoded cipher text |
len | on return contains the size of the ciphertext |
E_UNKNOWN | in case of an error |
E_SUCCESS | otherwise |
References E_SUCCESS, E_UNKNOWN, len, and m_pRSA.
Referenced by encryptXMLElement(), CALocalProxy::loop(), and testSpeed().
Encrypts one block of plain text using PKCS1 padding.
from | pointer to one block of plain text |
fromlen | size of the plain text |
to | the OAEP encoded cipher text |
len | on return contains the size of the ciphertext |
E_UNKNOWN | in case of an error |
E_SUCCESS | otherwise Temporarly will be removed soon. |
Generates a new random key-pair of size
bits.
size | keysize of the new keypair |
E_UNKNOWN | in case of an error |
E_SUCCESS | otherwise |
References E_SUCCESS, E_UNKNOWN, m_pRSA, and setRSAFlags().
Referenced by CALastMix::init(), CAMiddleMix::init(), and testSpeed().
|
private |
References CABase64::decode(), E_SUCCESS, and getDOMElementValue().
Referenced by setPublicKeyAsDOMNode().
SINT32 CAASymCipher::getPublicKeyAsDOMElement | ( | DOMElement *& | elemRoot, |
XERCES_CPP_NAMESPACE::DOMDocument * | docOwner | ||
) |
References addKeyPart(), createDOMElement(), E_SUCCESS, E_UNKNOWN, and m_pRSA.
Referenced by getPublicKeyAsXML(), CALastMix::processKeyExchange(), and CAMiddleMix::processKeyExchange().
Stores the public key in buff
.
The format is as follows:
\li \c SIZE-N [2 bytes] - number of bytes which are needed for the
modulus n (in network byte order..)
N
[SIZE-N bytes] - the modulus n
as integer (in network byte order) SIZE-E
[2 bytes] - number of bytes which are needed for the exponent e (in network byte order..) E
[SIZE-E bytes] - the exponent e
as integer (in network byte order) @param buff byte array in which the public key should be stored @param len on input holds the size of \c buff, on return it containsthe number of bytes needed to store the public key
E_UNKNOWN | in case of an error |
E_SUCCESS | otherwise |
key
. The format must match the format described for getPublicKey(). key | byte array which holds the new public key |
len | on input,size of key byte array, on successful return number of bytes 'consumed' |
E_UNKNOWN | in case of an error, the cipher is the uninitialized (no key is set) |
E_SUCCESS | otherwise |
buff
as XML. The format is as follows: \verbatim <RSAKeyValue> <Modulus> the modulus of the Key as ds::CryptoBinary </Modulus> <Exponent> the exponent of the key as ds::CryptoBinary </Exponent> <RSAKeyValue>There is NO \0 at the end.
buff | byte array in which the public key should be stored |
len | on input holds the size of buff , on return it contains the number of bytes needed to store the public key |
E_UNKNOWN | in case of an error |
E_SUCCESS | otherwise |
References createDOMDocument(), DOM_Output::dumpToMem(), E_SUCCESS, E_UNKNOWN, getPublicKeyAsDOMElement(), len, and m_pRSA.
SINT32 CAASymCipher::setPublicKey | ( | const CACertificate * | pCert | ) |
Sets the public key which is used for encryption to the contained in the provided certificate.
The key has to be a RSA public key.
E_SUCCESS | if successful |
E_UNKNOWN | otherwise (in this case the key leaves untouched) |
References E_SUCCESS, E_UNKNOWN, CACertificate::m_pCert, m_pRSA, and setRSAFlags().
Referenced by CAMsg::openEncryptedLog().
SINT32 CAASymCipher::setPublicKey | ( | const UINT8 * | modulus, |
UINT32 | moduluslen, | ||
const UINT8 * | exponent, | ||
UINT32 | exponentlen | ||
) |
References CABase64::decode(), E_SUCCESS, E_UNKNOWN, m_pRSA, and setRSAFlags().
SINT32 CAASymCipher::setPublicKeyAsDOMNode | ( | DOMNode * | node | ) |
References E_SUCCESS, E_UNKNOWN, equals(), getKeyPart(), m_pRSA, and setRSAFlags().
Referenced by CAMiddleMix::processKeyExchange(), and setPublicKeyAsXML().
Sets the public key to the values stored in key
.
The format must match the format XML described for getPublicKeyAsXML().
key | byte array which holds the new public key |
len | on input,size of key byte array, on successful return number of bytes 'consumed' |
E_UNKNOWN | in case of an error, the cipher is the uninitialized (no key is set) |
E_SUCCESS | otherwise |
References E_UNKNOWN, len, parseDOMDocument(), and setPublicKeyAsDOMNode().
Referenced by CAMiddleMix::init().
|
static |
References CAASymCipher(), decryptOAEP(), diff64(), E_SUCCESS, E_UNKNOWN, encryptOAEP(), generateKeyPair(), getcurrentTimeMillis(), and getRandom().
|
private |