#include <OpenSSLCryptoSymmetricKey.hpp>
Inheritance diagram for OpenSSLCryptoSymmetricKey:
This is the implementation for a wrapper of OpenSSL symmetric crypto functions.
Public Member Functions | |
Constructors and Destructors | |
OpenSSLCryptoSymmetricKey (XSECCryptoSymmetricKey::SymmetricKeyType type) | |
Constructor. | |
virtual | ~OpenSSLCryptoSymmetricKey () |
Destructor. | |
Basic CryptoKey Interface methods | |
virtual const XMLCh * | getProviderName () |
Returns a string that identifies the crypto owner of this library. | |
virtual XSECCryptoKey * | clone () |
Clone the key. | |
Symmetric key interface methods | |
SymmetricKeyType | getSymmetricKeyType (void) |
What type of symmetric key is this? | |
void | setKey (const unsigned char *key, unsigned int keyLen) |
Set the key from the provided bytes. | |
virtual bool | decryptInit (bool doPad=true, SymmetricKeyMode mode=MODE_CBC, const unsigned char *iv=NULL) |
Initialise an decryption process. | |
virtual unsigned int | decrypt (const unsigned char *inBuf, unsigned char *plainBuf, unsigned int inLength, unsigned int maxOutLength) |
Continue an decrypt operation using this key. | |
virtual unsigned int | decryptFinish (unsigned char *plainBuf, unsigned int maxOutLength) |
Finish a decryption operation. | |
virtual bool | encryptInit (bool doPad=true, SymmetricKeyMode mode=MODE_CBC, const unsigned char *iv=NULL) |
Initialise an encryption process. | |
virtual unsigned int | encrypt (const unsigned char *inBuf, unsigned char *cipherBuf, unsigned int inLength, unsigned int maxOutLength) |
Continue an encryption operation using this key. | |
virtual unsigned int | encryptFinish (unsigned char *plainBuf, unsigned int maxOutLength) |
Finish a encryption operation. |
|
Constructor. Can only construct a Symmetric key if we know what type it is |
|
Destructor. Implementations must ensure that the held key is properly destroyed (overwritten) when key objects are deleted. |
|
Clone the key. All keys need to be able to copy themselves and return a pointer to the copy. This allows the library to duplicate keys. Implements XSECCryptoSymmetricKey. |
|
Continue an decrypt operation using this key. Decryption must have been set up using an encryptInit call. Takes the inBuf and continues a decryption operation, writing the output to outBuf. This function does not have to guarantee that all input will be decrypted. In cases where the input is not a length of the block size, the implementation will need to hold back cipher-text to be handles during the next operation.
Implements XSECCryptoSymmetricKey. |
|
Finish a decryption operation. Complete a decryption process. No cipher text is passed in, as this should simply be removing any remaining text from the plain storage buffer. May throw an exception if there is some stored cipher text that is not the length of the block size for block algorithms.
Implements XSECCryptoSymmetricKey. |
|
Initialise an decryption process. Setup the key to get ready for a decryption session. Callers can pass in an IV. If one is not provided, but the algorithm requires one (e.g. 3DES_CBC), then implementations should assume that the start of the cipher text stream will in fact be the IV.
Implements XSECCryptoSymmetricKey. |
|
Continue an encryption operation using this key. Encryption must have been set up using an encryptInit call. Takes the inBuf and continues a encryption operation, writing the output to outBuf. This function does not have to guarantee that all input will be encrypted. In cases where the input is not a length of the block size, the implementation will need to hold back plain-text to be handled during the next operation.
Implements XSECCryptoSymmetricKey. |
|
Finish a encryption operation. Complete a encryption process. No plain text is passed in, as this should simply be removing any remaining text from the plain storage buffer and creating a final padded block. Padding is performed by taking the remaining block, and setting the last byte to equal the number of bytes of padding. If the plain was an exact multiple of the block size, then an extra block of padding will be used. For example, if the block size is 8 bytes, and there were three remaining plain text bytes (0x01, 0x02 and 0x03), the final block will be : 0x010203????????05
Implements XSECCryptoSymmetricKey. |
|
Initialise an encryption process. Setup the key to get ready for a decryption session. Callers can pass in an IV. If one is not provided, but the algorithm requires one (e.g. 3DES_CBC), then implementations are required to generate one.
Implements XSECCryptoSymmetricKey. |
|
Returns a string that identifies the crypto owner of this library.
Implements XSECCryptoSymmetricKey. |
|
What type of symmetric key is this? There are a number of different types of symmetric key. This method allows callers to determine the type of this particular key Implements XSECCryptoSymmetricKey. |
|
Set the key from the provided bytes. Symmetric keys can all be loaded from a buffer containing a series of bytes.
Implements XSECCryptoSymmetricKey. |