CPKIFMessageImprint Class Reference

#include <MessageImprint.h>

Collaboration diagram for CPKIFMessageImprint:

Collaboration graph
[legend]

List of all members.


Detailed Description

The CPKIFMessageImprint class provides an interface to RFC 3161 MessageImprint objects, including an optional capability of generating digest values.
MessageImprint ::= SEQUENCE 
{
	hashAlgorithm AlgorithmIdentifier,
	hashedMessage OCTET STRING 
}
TSP-enforcing: No

Definition at line 35 of file MessageImprint.h.


Public Member Functions

 CPKIFMessageImprint ()
 CPKIFMessageImprint (const CPKIFBufferPtr &miBuf)
 ~CPKIFMessageImprint ()
void SetHashAlgorithm (CPKIFAlgorithmIdentifierPtr &hashAlgorithm)
CPKIFAlgorithmIdentifierPtr GetHashAlgorithm () const
void SetHashedMessage (CPKIFBufferPtr &hashedMessage)
CPKIFBufferPtr GetHashedMessage () const
CPKIFBufferPtr HashAndSet (PKIFCRYPTO::HASH_ALG hashAlgorithm, CPKIFBufferPtr &dataToHash, IPKIFMediator *m=NULL)

Constructor & Destructor Documentation

CPKIFMessageImprint::CPKIFMessageImprint (  ) 

Interface: External

This function is used to create and initialize CPKIFMessageImprint object.

Returns:
None

Definition at line 44 of file MessageImprint.cpp.

References g_sha1AI, LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

CPKIFMessageImprint::CPKIFMessageImprint ( const CPKIFBufferPtr &  miBuf  ) 

Interface: External

This function is used to create and initialize CPKIFMessageImprint object.

Returns:
None
Parameters:
miBuf  [in] Reference to a PKIFTSPMessageImprint structure containing information used to populate a new instance of CPKIFMessageImprint

Definition at line 57 of file MessageImprint.cpp.

References CACASNWRAPPER_CREATE, LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

CPKIFMessageImprint::~CPKIFMessageImprint (  ) 

Interface: External

This function destroys instances of CPKIFMessageImprint.

Returns:
None

Definition at line 94 of file MessageImprint.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.


Member Function Documentation

void CPKIFMessageImprint::SetHashAlgorithm ( CPKIFAlgorithmIdentifierPtr &  hashAlgorithm  ) 

Interface: External

This function is used to set the algorithm used to calculate the associated digest value.

Returns:
None
Parameters:
hashAlgorithm  [in] Reference to a smart pointer to a CPKIFAlgorithmIdentifier object containing information identifying the hash algorithm associated with a MessageImprint object

Definition at line 109 of file MessageImprint.cpp.

Referenced by HashAndSet().

CPKIFAlgorithmIdentifierPtr CPKIFMessageImprint::GetHashAlgorithm (  )  const

Interface: External

This function is used to set the algorithm used to calculate the associated digest value.

Returns:
The hash algorithm used to calculate the associated digest value

Definition at line 123 of file MessageImprint.cpp.

void CPKIFMessageImprint::SetHashedMessage ( CPKIFBufferPtr &  hashedMessage  ) 

Interface: External

This function is used to set the digest value calculated using the associated digest algorithm.

Returns:
None
Parameters:
hashedMessage  [in] Reference to a smart pointer to a CPKIFBuffer object containing the message digest included in a MessageDigest object

Definition at line 134 of file MessageImprint.cpp.

Referenced by HashAndSet().

CPKIFBufferPtr CPKIFMessageImprint::GetHashedMessage (  )  const

Interface: External

This function is used to get the digest value calculated using the associated digest algorithm.

Returns:
The digest value calculated using the associated digest algorithm

Definition at line 148 of file MessageImprint.cpp.

CPKIFBufferPtr CPKIFMessageImprint::HashAndSet ( PKIFCRYPTO::HASH_ALG  hashAlgorithm,
CPKIFBufferPtr &  dataToHash,
IPKIFMediator m = NULL 
)

Interface: External

This function is used to generate a digest value using the specified algorithm. The m parameter can be used to specify a mediator containing the IPKIFCryptoMisc interface to use when calculating the digest value. If m is set to NULL a local instance of the CPKIFCAPIRaw class will be used to calculate the digest value. When digesting large blocks of data (or any digest calculated iteratively), this function should not be used. Instead the digest value should be calculated and associated with a CPKIFMessageImprint object using the SetHashedMessage and SetHashAlgorithm functions.

//create a message to timestamp
char* buf = "Message to timestamp";
int buflen = strlen(buf);
CPKIFBufferPtr msg(new CPKIFBuffer((unsigned char*)buf, buflen));

//create a message imprint structure to hash of the message
CPKIFMessageImprintPtr messageImprint(new CPKIFMessageImprint);

//hash the message
messageImprint->HashAndSet(SHA1, msg);

Returns:
None
Parameters:
hashAlgorithm  [in] HASH_ALG value indicating the algorithm to use when generating the message digest over the data passed via the dataToHash parameter
dataToHash  [in] Reference to a smart pointer to a CPKIFBuffer object containing the message to hash
m  [in] Pointer to an IPKIFMediator object to use when calculating the message digest of the data passed via the dataToHash parameter

Definition at line 179 of file MessageImprint.cpp.

References GetHashAlgAI(), IPKIFColleague::GetMediator(), GetPlatformCryptoMisc(), IPKIFCryptoMisc::HashFinal(), IPKIFCryptoMisc::HashInit(), IPKIFCryptoMisc::HashUpdate(), LOG_STRING_DEBUG, MAXHASH, SetHashAlgorithm(), SetHashedMessage(), and TOOLKIT_TSP_ASN.


The documentation for this class was generated from the following files:

Generated on Mon Nov 15 11:20:26 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6