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

XSECCryptoHash Class Reference
[Cryptographic Abstraction Layer]

#include <XSECCryptoHash.hpp>

Inheritance diagram for XSECCryptoHash:

Inheritance graph
[legend]
List of all members.

Detailed Description

Interface definition for Hash functions.

The XSECCryptoHash function is used by the library to manipulate Hashing (Digest) functions.

It is also used as the base class for HMAC functions, and thus has a setKey() method.

Todo:
bring the interface here in-line with that provided for XSECCryptoBase64 - really should have only one way of calling these kinds of objects.


Public Types

enum  HashType {
  HASH_NONE = 0,
  HASH_SHA1 = 1,
  HASH_MD5 = 2,
  HASH_SHA224 = 3,
  HASH_SHA256 = 4,
  HASH_SHA384 = 5,
  HASH_SHA512 = 6
}
 Enumeration of Hash (Digest) types. More...

Public Member Functions

 XSECCryptoHash ()
virtual ~XSECCryptoHash ()
Digest/Hash functions
virtual void reset (void)=0
 Rest the hash function.
virtual void hash (unsigned char *data, unsigned int length)=0
 Hash some data.
virtual unsigned int finish (unsigned char *hash, unsigned int maxLength)=0
 Finish up a Digest operation and read the result.
Information functions
virtual HashType getHashType (void)=0
HMAC Functions
virtual void setKey (XSECCryptoKey *key)=0


Member Enumeration Documentation

enum XSECCryptoHash::HashType
 

Enumeration of Hash (Digest) types.

The hash types known to XSEC

Enumeration values:
HASH_NONE 
HASH_SHA1 
HASH_MD5 
HASH_SHA224 
HASH_SHA256 
HASH_SHA384 
HASH_SHA512 


Constructor & Destructor Documentation

XSECCryptoHash::XSECCryptoHash  )  [inline]
 

virtual XSECCryptoHash::~XSECCryptoHash  )  [inline, virtual]
 


Member Function Documentation

virtual unsigned int XSECCryptoHash::finish unsigned char *  hash,
unsigned int  maxLength
[pure 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)

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

Implemented in OpenSSLCryptoHash, OpenSSLCryptoHashHMAC, WinCAPICryptoHash, and WinCAPICryptoHashHMAC.

virtual HashType XSECCryptoHash::getHashType void   )  [pure virtual]
 

Determine the hash type of this object

Returns:
The hash type

Implemented in OpenSSLCryptoHash, OpenSSLCryptoHashHMAC, WinCAPICryptoHash, and WinCAPICryptoHashHMAC.

virtual void XSECCryptoHash::hash unsigned char *  data,
unsigned int  length
[pure 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

Implemented in OpenSSLCryptoHash, OpenSSLCryptoHashHMAC, WinCAPICryptoHash, and WinCAPICryptoHashHMAC.

virtual void XSECCryptoHash::reset void   )  [pure virtual]
 

Rest the hash function.

XSEC will call the reset() function prior to re-using a CryptoHash object.

Implemented in OpenSSLCryptoHash, OpenSSLCryptoHashHMAC, WinCAPICryptoHash, and WinCAPICryptoHashHMAC.

virtual void XSECCryptoHash::setKey XSECCryptoKey key  )  [pure virtual]
 

The HMAC classes are treated in the library as standard hash objects that just happen to take a key. Thus all hash functions implement this function (potentially just to throw an exception)

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

Parameters:
key The key the HMAC function should use.

Implemented in OpenSSLCryptoHash, OpenSSLCryptoHashHMAC, WinCAPICryptoHash, and WinCAPICryptoHashHMAC.


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