00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef WINCAPICRYPTOHASHHMAC_INCLUDE
00029 #define WINCAPICRYPTOHASHHMAC_INCLUDE
00030
00031 #include <xsec/framework/XSECDefs.hpp>
00032 #include <xsec/enc/XSECCryptoHash.hpp>
00033
00034 #if defined (HAVE_WINCAPI)
00035
00036 #if !defined(_WIN32_WINNT)
00037 # define _WIN32_WINNT 0x0400
00038 #endif
00039
00040 #include <wincrypt.h>
00041
00042 class WinCAPICryptoProvider;
00043
00067 class DSIG_EXPORT WinCAPICryptoHashHMAC : public XSECCryptoHash {
00068
00069
00070 public :
00071
00074
00087 WinCAPICryptoHashHMAC(HCRYPTPROV prov, XSECCryptoHash::HashType alg);
00088 virtual ~WinCAPICryptoHashHMAC();
00089
00091
00094
00104 virtual void setKey(XSECCryptoKey * key);
00105
00107
00110
00117 virtual void reset(void);
00118
00130 virtual void hash(unsigned char * data,
00131 unsigned int length);
00132
00146 virtual unsigned int finish(unsigned char * hash,
00147 unsigned int maxLength);
00148
00150
00153
00162 virtual HashType getHashType(void);
00163
00165
00166 private:
00167
00168
00169 WinCAPICryptoHashHMAC();
00170
00171 unsigned char m_mdValue[XSEC_MAX_HASH_SIZE];
00172 unsigned int m_mdLen;
00173
00174 ALG_ID m_algId;
00175 XSECCryptoHash::HashType m_hashType;
00176
00177 HCRYPTPROV m_p;
00178 HCRYPTHASH m_h;
00179
00180 unsigned char m_ipadKeyed[XSEC_MAX_HASH_SIZE];
00181 unsigned char m_opadKeyed[XSEC_MAX_HASH_SIZE];
00182
00183 unsigned int m_blockSize;
00184
00185
00186 void eraseKeys();
00187
00188 };
00189
00190 #endif
00191 #endif