Rudiments
|
Inherits object.
Inherited by aes128.
Public Member Functions | |
encryption () | |
virtual | ~encryption () |
virtual bool | setKey (const byte_t *key, size_t keysize) |
virtual void | setRandomKey () |
virtual byte_t * | getKey () |
virtual size_t | getKeySize ()=0 |
virtual bool | setIv (const byte_t *iv, size_t ivsize) |
virtual void | setRandomIv () |
virtual byte_t * | getIv () |
virtual size_t | getIvSize ()=0 |
virtual bool | append (const byte_t *data, uint32_t size) |
virtual const byte_t * | getEncryptedData ()=0 |
virtual uint64_t | getEncryptedDataSize () |
virtual const byte_t * | getDecryptedData ()=0 |
virtual uint64_t | getDecryptedDataSize () |
virtual encryptionerror_t | getError () |
virtual bool | clear () |
virtual bool | reset () |
Public Member Functions inherited from object | |
virtual | ~object () |
The encryption class provides a simple encryption interface.
encryption::encryption | ( | ) |
Creates an instance of the encryption class.
|
virtual |
Deletes this instance of the encryption class.
|
virtual |
Appends "size" bytes of "data" to the data to be encrypted/decrypted.
Returns true on success or false if an error occurred.
|
virtual |
Clears the current encrypted/decrypted data and any data that had been appended.
Does not clear the key or initialization vector.
This implementation always returns true, but a child class may override this method to return false if something fails, and possibly set an error.
|
pure virtual |
Interprets the current data as encrypted. Decrypts the current data.
Returns the decrypted data on success or NULL if an error occurred.
Note that the decrypted data returned will be an empty string if no data has been appended yet.
Implemented in aes128.
|
virtual |
Returns the number of bytes of decrypted data.
|
pure virtual |
Interprets the current data as unencrypted. Encrypts the current data.
Returns the encrypted data on success or NULL if an error occurred.
Note that the encrypted data returned will be an empty string if no data has been appended yet.
Implemented in aes128.
|
virtual |
Returns the number of bytes of encrypted data.
|
virtual |
Returns the most recent error.
|
virtual |
Returns the initialization vector currently used for encryption/decryption. If no initialization vector has been set, then this will be a block of 0's.
|
pure virtual |
Returns the number of bytes in the initialization vector.
Implemented in aes128.
|
virtual |
Returns the key currently used for encryption/decryption. If no key has been set, then this will be a block of 0's.
|
pure virtual |
Returns the number of bytes in the key.
Implemented in aes128.
|
virtual |
Clears the current encrypted/decrypted data, any data that had been appended, any current error, key, and initialization vector.
This implementation always returns true, but a child class may override this method to return false if something fails, and possibly set an error.
|
virtual |
Sets the initialization vector used for encryption/decryption to the first "ivsize" bytes of "iv".
Returns true on success and false if an error occurred.
The most common error is that "ivsize" is not the correct number of bytes. The method getKeySize() returns the correct number of bytes for the key.
|
virtual |
Sets the key used for encryption/decryption to the first "keysize" bytes of "key".
Returns true on success and false if an error occurred.
The most common error is that "keysize" is not the correct number of bytes. The method getKeySize() returns the correct number of bytes for the key.
|
virtual |
Sets the initialization vector used encryption/decryption to random data. The data used can be retrived using getKey().
|
virtual |
Sets the key used for encryption/decryption to random data. The data used can be retrived using getKey().