#include <mmscrypt.h>
Public Member Functions | |
| MMSCrypt (string keyfile=MMSCRYPT_DEFAULT_KEY_FILENAME) | |
| Constructor for accessing cryptographic functions. | |
| ~MMSCrypt () | |
| Destructor of MMSCrypt class. | |
| unsigned char * | encrypt (unsigned char *in, unsigned int size=0, bool useMMSCtx=false) |
| Encrypts a given buffer. | |
| unsigned char * | decrypt (unsigned char *in, unsigned int size=0, bool useMMSCtx=false) |
| Decrypts a given buffer. | |
Private Member Functions | |
| unsigned char * | createUserKey (string keyfile) |
| Creates an SSL key that will be saved in the given file. | |
| unsigned char * | getUserKey (string keyfile) |
| Returns an SSL key that was stored in the given file. | |
Private Attributes | |
| EVP_CIPHER_CTX | mmsCtx |
| private disko cipher context | |
| EVP_CIPHER_CTX | userCtx |
| user cipher context | |
This class simply provides helper methods for de- and encrypting buffers.
Definition at line 60 of file mmscrypt.h.
| MMSCrypt::MMSCrypt | ( | string | keyfile = MMSCRYPT_DEFAULT_KEY_FILENAME |
) |
Constructor for accessing cryptographic functions.
| keyfile | filename of user key |
| MMSCryptError | keyfile could not be opened or created |
Definition at line 106 of file mmscrypt.cpp.
| MMSCrypt::~MMSCrypt | ( | ) |
Destructor of MMSCrypt class.
Frees all used resources.
Definition at line 124 of file mmscrypt.cpp.
| unsigned char * MMSCrypt::encrypt | ( | unsigned char * | in, | |
| unsigned int | size = 0, |
|||
| bool | useMMSCtx = false | |||
| ) |
Encrypts a given buffer.
| in | buffer to encrypt | |
| size | size of buffer (in) to encrypt | |
| useMMSCtx | if set to true private disko context will be used, otherwise use user key |
| MMSCryptError | An error occured while encrypting (call MMSError::getMessage() for a detailed error message. |
Definition at line 129 of file mmscrypt.cpp.
| unsigned char * MMSCrypt::decrypt | ( | unsigned char * | in, | |
| unsigned int | size = 0, |
|||
| bool | useMMSCtx = false | |||
| ) |
Decrypts a given buffer.
| in | buffer to decrypt | |
| size | size of buffer to decrypt | |
| useMMSCtx | if set to true private disko context will be used, otherwise use user key |
| MMSCryptError | Not enough memory for decrypting the message. |
Definition at line 164 of file mmscrypt.cpp.
| unsigned char * MMSCrypt::createUserKey | ( | string | keyfile | ) | [private] |
Creates an SSL key that will be saved in the given file.
| keyfile | save encrypted key to this file |
Definition at line 51 of file mmscrypt.cpp.
| unsigned char * MMSCrypt::getUserKey | ( | string | keyfile | ) | [private] |
Returns an SSL key that was stored in the given file.
If the file doesn't exist, a new key will be generated and saved.
| keyfile | read encrypted key from this file |
| MMSCryptError | File could not be opened. |
Definition at line 75 of file mmscrypt.cpp.
EVP_CIPHER_CTX MMSCrypt::mmsCtx [private] |
EVP_CIPHER_CTX MMSCrypt::userCtx [private] |