#include <QtCrypto>
Inheritance diagram for QCA::MessageAuthenticationCode:
Public Member Functions | |
MessageAuthenticationCode (const QString &type, const SymmetricKey &key, const QString &provider=QString()) | |
MessageAuthenticationCode (const MessageAuthenticationCode &from) | |
MessageAuthenticationCode & | operator= (const MessageAuthenticationCode &from) |
QString | type () const |
KeyLength | keyLength () const |
bool | validKeyLength (int n) const |
virtual void | clear () |
virtual void | update (const MemoryRegion &array) |
virtual MemoryRegion | final () |
void | setup (const SymmetricKey &key) |
MessageAuthenticationCode is a class for accessing the various message authentication code algorithms within QCA. HMAC using SHA1 ("hmac(sha1)") or HMAC using SHA256 ("hmac(sha256)") is recommended for new applications.
Note that if your application is potentially susceptable to "replay attacks" where the message is sent more than once, you should include a counter in the message that is covered by the MAC, and check that the counter is always incremented every time you receive a message and MAC.
For more information on HMAC, see H. Krawczyk et al. RFC2104 "HMAC: Keyed-Hashing for Message Authentication"
|
Standard constructor.
|
|
Standard copy constructor.
|
|
Assignment operator. Copies the state (including key) from one MessageAuthenticationCode to another |
|
Return the MAC type.
Reimplemented from QCA::Algorithm. |
|
Return acceptable key lengths.
|
|
Test if a key length is valid for the MAC algorithm.
|
|
Reset a MessageAuthenticationCode, dumping all previous parts of the message. This method clears (or resets) the algorithm, effectively undoing any previous update() calls. You should use this call if you are re-using a MessageAuthenticationCode sub-class object to calculate additional MACs. Note that if the key doesn't need to be changed, you don't need to call setup() again, since the key can just be reused. Implements QCA::BufferedComputation. |
|
Update the MAC, adding more of the message contents to the digest. The whole message needs to be added using this method before you call final().
Implements QCA::BufferedComputation.
|
|
Finalises input and returns the MAC result. After calling update() with the required data, the hash results are finalised and produced. Note that it is not possible to add further data (with update()) after calling final(). If you want to reuse the MessageAuthenticationCode object, you should call clear() and start to update() again. Implements QCA::BufferedComputation.
|
|
Initialise the MAC algorithm.
|