• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

qca

QCA::MessageAuthenticationCode

QCA::MessageAuthenticationCode Class Reference
[QCA user API]

#include <QtCrypto>

Inheritance diagram for QCA::MessageAuthenticationCode:

Inheritance graph
[legend]

List of all members.


Detailed Description

General class for message authentication code (MAC) algorithms.

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"

Definition at line 768 of file qca_basic.h.


Public Member Functions

virtual void clear ()
virtual MemoryRegion final ()
KeyLength keyLength () const
 MessageAuthenticationCode (const MessageAuthenticationCode &from)
 MessageAuthenticationCode (const QString &type, const SymmetricKey &key, const QString &provider=QString())
MessageAuthenticationCode & operator= (const MessageAuthenticationCode &from)
void setup (const SymmetricKey &key)
QString type () const
virtual void update (const MemoryRegion &array)
bool validKeyLength (int n) const
 ~MessageAuthenticationCode ()

Static Public Member Functions

static QStringList supportedTypes (const QString &provider=QString())

Constructor & Destructor Documentation

QCA::MessageAuthenticationCode::MessageAuthenticationCode ( const QString &  type,
const SymmetricKey &  key,
const QString &  provider = QString() 
)

Standard constructor.

Parameters:
type the name of the MAC (and algorithm, if applicable) to use
key the shared key
provider the provider to use, if a particular provider is required

Definition at line 436 of file qca_basic.cpp.

QCA::MessageAuthenticationCode::MessageAuthenticationCode ( const MessageAuthenticationCode &  from  ) 

Standard copy constructor.

Copies the state (including key) from one MessageAuthenticationCode to another

Parameters:
from the MessageAuthenticationCode to copy state from

Definition at line 445 of file qca_basic.cpp.

QCA::MessageAuthenticationCode::~MessageAuthenticationCode (  ) 

Definition at line 451 of file qca_basic.cpp.


Member Function Documentation

void QCA::MessageAuthenticationCode::clear (  )  [virtual]

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.

Definition at line 485 of file qca_basic.cpp.

MemoryRegion QCA::MessageAuthenticationCode::final (  )  [virtual]

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.

Definition at line 498 of file qca_basic.cpp.

KeyLength QCA::MessageAuthenticationCode::keyLength (  )  const

Return acceptable key lengths.

Definition at line 474 of file qca_basic.cpp.

MessageAuthenticationCode & QCA::MessageAuthenticationCode::operator= ( const MessageAuthenticationCode &  from  ) 

Assignment operator.

Copies the state (including key) from one MessageAuthenticationCode to another

Parameters:
from the MessageAuthenticationCode to assign from.

Definition at line 456 of file qca_basic.cpp.

void QCA::MessageAuthenticationCode::setup ( const SymmetricKey &  key  ) 

Initialise the MAC algorithm.

Parameters:
key the key to use for the algorithm

Definition at line 508 of file qca_basic.cpp.

QStringList QCA::MessageAuthenticationCode::supportedTypes ( const QString &  provider = QString()  )  [static]

Returns a list of all of the message authentication code types available.

Parameters:
provider the name of the provider to get a list from, if one provider is required. If not specified, available message authentication codes types from all providers will be returned.

Definition at line 463 of file qca_basic.cpp.

QString QCA::MessageAuthenticationCode::type (  )  const

Return the MAC type.

Reimplemented from QCA::Algorithm.

Definition at line 468 of file qca_basic.cpp.

void QCA::MessageAuthenticationCode::update ( const MemoryRegion &  array  )  [virtual]

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().

Parameters:
array the message contents

Implements QCA::BufferedComputation.

Definition at line 491 of file qca_basic.cpp.

bool QCA::MessageAuthenticationCode::validKeyLength ( int  n  )  const

Test if a key length is valid for the MAC algorithm.

Parameters:
n the key length in bytes
Returns:
true if the key would be valid for the current algorithm

Definition at line 479 of file qca_basic.cpp.


The documentation for this class was generated from the following files:
  • qca_basic.h
  • qca_basic.cpp

qca

Skip menu "qca"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  •   server
  • Decibel
  • eigen
  • Eigen2
  • kdewin32
  • Phonon
  •     Backend
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal