#include <MessageImprint.h>
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) |
CPKIFMessageImprint::CPKIFMessageImprint | ( | ) |
Interface: External
This function is used to create and initialize CPKIFMessageImprint object.
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.
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.
Definition at line 94 of file MessageImprint.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.
void CPKIFMessageImprint::SetHashAlgorithm | ( | CPKIFAlgorithmIdentifierPtr & | hashAlgorithm | ) |
Interface: External
This function is used to set the algorithm used to calculate the associated digest value.
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.
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.
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.
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);
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.