00001 00009 #ifndef __MESSAGEIMPRINT_H__ 00010 #define __MESSAGEIMPRINT_H__ 00011 00012 #include "PKIFdll.h" 00013 #include "PKIFTSPDLL.h" 00014 #include "PKIFCryptoConstants.h" 00015 00016 // forward definitions 00017 struct CPKIFMessageImprintImpl; 00018 FD_MC_PTR(); 00019 00020 FD_SMART_PTR(CPKIFAlgorithmIdentifier); 00021 FD_SMART_PTR(CPKIFBuffer); 00022 00035 class PKIFTSP_API CPKIFMessageImprint 00036 { 00037 public: 00038 CPKIFMessageImprint(); 00039 CPKIFMessageImprint(const CPKIFBufferPtr& miBuf); 00040 ~CPKIFMessageImprint(); 00041 00042 //set/get algorithm used to produce hash passed to SetHashedMessage 00043 void SetHashAlgorithm(CPKIFAlgorithmIdentifierPtr& hashAlgorithm); 00044 CPKIFAlgorithmIdentifierPtr GetHashAlgorithm() const; 00045 00046 //set/get hash value produces by hashing external message with hash alg passed 00047 //to SetHashAlgorithm 00048 void SetHashedMessage(CPKIFBufferPtr& hashedMessage); 00049 CPKIFBufferPtr GetHashedMessage() const; 00050 00051 //convenience function that takes a message and an alg id and produces 00052 //a hash value (for hashing large blocks of data produce hash independent 00053 //of this class and use the Set/Get methods above). If m is NULL or m does not 00054 //contain the necessary interface then the CPKIFCAPIRaw class will be used to 00055 //produce hash. Pass a mediator containing the IPKIFCryptoMisc interface to 00056 //control the hash implementation used. The hashed value is returned. 00057 CPKIFBufferPtr HashAndSet(PKIFCRYPTO::HASH_ALG hashAlgorithm, CPKIFBufferPtr& dataToHash, IPKIFMediator* m = NULL); 00058 00059 private: 00060 CPKIFMessageImprint(const CPKIFMessageImprint& copy); 00061 CPKIFMessageImprint& operator=(const CPKIFMessageImprint& rhs); //added 4/6/2004 00062 00063 struct CPKIFMessageImprintImpl *m_impl; 00064 }; 00065 DECLARE_SMART_POINTERS(CPKIFMessageImprint); 00066 00067 #endif //__MESSAGEIMPRINT_H__