#include <cryptography.h>
Public Member Functions | |
CryptoManager (const string &pk) | |
Default constructor. | |
CryptoSession * | createSession () |
The crypto factory. | |
Static Public Member Functions | |
byte * | hash (const string &str, unsigned int &len, CryptDefines::Hashes type=CryptDefines::DefaultHash) throw (AlgoError) |
Generate a hash of the given std::string using the given hash type. | |
string | encode (const SecByteBlock &array, CryptDefines::Encoding enc=CryptDefines::DefaultEncoder) throw (AlgoError) |
Encode a byte array. | |
string | encode (const string &str, CryptDefines::Encoding enc=CryptDefines::DefaultEncoder) |
byte * | decode (const string &input, unsigned int &outLen, CryptDefines::Encoding enc) throw (AlgoError) |
Decode a string to byte array. | |
string | hashEncode (const string &str, CryptDefines::Hashes type=CryptDefines::DefaultHash, CryptDefines::Encoding enc=CryptDefines::DefaultEncoder) throw (AlgoError) |
Hash and encode in one swoop. | |
byte * | generateRandom (const unsigned int size) throw (RNGError) |
Generate a specified number of bytes using the OS supplied random number generator. | |
byte * | encrypt (const SecByteBlock &data, const SecByteBlock &key, unsigned int &resultLen, const unsigned int blockSize=0, CryptDefines::BlockCipher cipher=CryptDefines::DefaultBC, CryptDefines::Mode mode=CryptDefines::DefaultMode) throw (RNGError, AlgoError, KeySizeError, BlockSizeError) |
Encrypt a data block with a key. | |
void | encryptToFileWithHMAC (const string &filename, const SecByteBlock &data, const SecByteBlock &key, const unsigned int blockSize=0, CryptDefines::BlockCipher bc=CryptDefines::DefaultBC, CryptDefines::Mode mode=CryptDefines::DefaultMode, CryptDefines::Hashes hash=CryptDefines::DefaultHash) throw (RNGError, AlgoError, KeySizeError, BlockSizeError, IOError) |
Encrypt a data block with a key. | |
byte * | compress (const SecByteBlock &data, unsigned int &resultLen, const unsigned int level=CryptDefines::DEFAULT_COMPRESS_LEVEL) |
Compress the data block with Zlib. | |
byte * | decompress (const SecByteBlock &data, unsigned int &resultLen) |
Decompress the data block with Zlib. | |
byte * | generateIV (const SecByteBlock &data, CryptDefines::Hashes hash=CryptDefines::DefaultHash) |
IV generation via hashing input data then XOR-ing it with itself. | |
unsigned int | testRNG (const unsigned int insize) throw (RNGError) |
bool | encryptFile (const string &filename, const VBuffer &key, const string &data) throw (IOError) |
string | decryptFile (const string &filename, const VBuffer &key) throw (InvalidPassword, AuthFailed) |
string | hashEncode (const VBuffer &toHash, CryptDefines::Hashes hash=CryptDefines::DefaultHash, CryptDefines::Encoding enc=CryptDefines::DefaultEncoder) |
VBuffer | hash (const VBuffer &toHash, CryptDefines::Hashes hash=CryptDefines::DefaultHash) |
Static Protected Member Functions | |
HashTransformation * | getHash (CryptDefines::Hashes type) throw (AlgoError) |
This function is not a member function due to the problems with non-inline member templates. | |
SymmetricCipher * | getEncryptor (CryptDefines::BlockCipher cipher, CryptDefines::Mode mode) throw (AlgoError) |
This class creates keys, encrypts, and decrypts data.
In other words, a dummied down interface to Crypto++.
This class is usually associated with an active Contact. The static hashing functions and disk i/o are used by the login/ contact loading class.
Definition at line 62 of file cryptography.h.
|
Compress the data block with Zlib.
|
|
Decode a string to byte array.
|
|
Decompress the data block with Zlib.
|
|
Encode a byte array.
|
|
Encrypt a data block with a key. Generates a random IV for the block cipher.
|
|
Grow container to ciphertext size Definition at line 333 of file cryptography.cpp.
|
|
Encrypt a data block with a key. Generates a random IV for the block cipher; a SHA.
|
|
IV generation via hashing input data then XOR-ing it with itself. This algorithm was sugguested by Denis Bider from the Crypto++ list.
References getHash().
Here is the call graph for this function: |
|
Generate a specified number of bytes using the OS supplied random number generator.
|
|
This function is not a member function due to the problems with non-inline member templates.
Referenced by generateIV().
|
|
Generate a hash of the given std::string using the given hash type.
|
|
Hash and encode in one swoop.
|