Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

WinCAPICryptoHashHMAC Class Reference
[Windows Crypto API Interface]

#include <WinCAPICryptoHashHMAC.hpp>

Inheritance diagram for WinCAPICryptoHashHMAC:

Inheritance graph
[legend]
Collaboration diagram for WinCAPICryptoHashHMAC:

Collaboration graph
[legend]
List of all members.

Detailed Description

Implementation of HMAC Hash functions in the Windows providers.

Uses the Windows Crypt* API functions to implement an HMAC.

Unfortunately the Windows Crypto API does not allow callers to enter an HMAC key directly. It relies on a seed being entered into a digest function that is then used to derive a key that can be used in an HMAC function.

Two types of key can therefore be used - a direct Windows key, or a "standard" string as the HMAC key. In the latter case, the HMAC function is implemented internally around a standard Windows hash function. In the former case, the Windows HMAC functions are used. (The latter case is mainly for interoperability testing, where the key is provided and needs to be entered "as is".


Public Member Functions

Constructors and Destructors
 WinCAPICryptoHashHMAC (HCRYPTPROV prov, XSECCryptoHash::HashType alg)
 Constructor.
virtual ~WinCAPICryptoHashHMAC ()
HMAC Functions
virtual void setKey (XSECCryptoKey *key)
 Set the HMAC key.
Hash functions
virtual void reset (void)
 Reset the hash function.
virtual void hash (unsigned char *data, unsigned int length)
 Hash some data.
virtual unsigned int finish (unsigned char *hash, unsigned int maxLength)
 Finish up a Digest operation and read the result.
Information functions
virtual HashType getHashType (void)


Constructor & Destructor Documentation

WinCAPICryptoHashHMAC::WinCAPICryptoHashHMAC HCRYPTPROV  prov,
XSECCryptoHash::HashType  alg
 

Constructor.

Create the object, with the indicated algorithm (Currently supports MD5 and SHA1)

Parameters:
prov handle to a provider that supports the required algorithm. Both PROV_RSA_FULL and PROV_DSS support MD5 and SHA1
alg Digest algorithm to use

virtual WinCAPICryptoHashHMAC::~WinCAPICryptoHashHMAC  )  [virtual]
 


Member Function Documentation

virtual unsigned int WinCAPICryptoHashHMAC::finish unsigned char *  hash,
unsigned int  maxLength
[virtual]
 

Finish up a Digest operation and read the result.

This call tells the CryptoHash object that the input is complete and to finalise the Digest. The output of the digest is read into the hash buffer (at most maxLength bytes). This is effectively the signature for the data that has been run through the HMAC function.

Parameters:
hash The buffer the hash should be read into.
maxLength The maximum number of bytes to be read into hash
Returns:
The number of bytes copied into the hash buffer

Implements XSECCryptoHash.

virtual HashType WinCAPICryptoHashHMAC::getHashType void   )  [virtual]
 

Determine the hash type of this object

Returns:
The hash type

Implements XSECCryptoHash.

virtual void WinCAPICryptoHashHMAC::hash unsigned char *  data,
unsigned int  length
[virtual]
 

Hash some data.

Take length bytes of data from the data buffer and update the hash that already exists. This function may (and normally will) be called many times for large blocks of data.

Parameters:
data The buffer containing the data to be hashed.
length The number of bytes to be read from data

Implements XSECCryptoHash.

virtual void WinCAPICryptoHashHMAC::reset void   )  [virtual]
 

Reset the hash function.

Re-initialises the digest structure.

Implements XSECCryptoHash.

virtual void WinCAPICryptoHashHMAC::setKey XSECCryptoKey key  )  [virtual]
 

Set the HMAC key.

Sets the key - which needs to have a base class of WinCAPICryptoKeyHMAC.

Parameters:
key The key the HMAC function should use.

Implements XSECCryptoHash.


The documentation for this class was generated from the following file:
Generated on Sun Jul 3 17:43:31 2005 for XML-Security-C by  doxygen 1.4.2