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

WinCAPICryptoHashHMAC.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2002-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * imitations under the License.
00015  */
00016 
00017 /*
00018  * XSEC
00019  *
00020  * WinCAPICryptoHashHMAC := Windows CAPI Implementation of HMAC
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: WinCAPICryptoHashHMAC.hpp,v 1.6 2004/02/08 10:23:33 blautenb Exp $
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(_WIN32_WINNT)
00035 #   define _WIN32_WINNT 0x0400
00036 #endif
00037 
00038 #include <wincrypt.h>
00039 
00040 class WinCAPICryptoProvider;
00041 
00066 class DSIG_EXPORT WinCAPICryptoHashHMAC : public XSECCryptoHash {
00067 
00068 
00069 public :
00070 
00073 
00086     WinCAPICryptoHashHMAC(HCRYPTPROV prov, XSECCryptoHash::HashType alg);
00087     virtual ~WinCAPICryptoHashHMAC();
00088 
00090 
00093     
00103     virtual void        setKey(XSECCryptoKey * key);
00104 
00106 
00109 
00116     virtual void        reset(void);
00117 
00129     virtual void        hash(unsigned char * data, 
00130                              unsigned int length);
00131 
00145     virtual unsigned int finish(unsigned char * hash,
00146                                 unsigned int maxLength);
00147 
00149 
00152 
00161     virtual HashType getHashType(void);
00162 
00164 
00165 private:
00166 
00167     // Not implemented constructors
00168     WinCAPICryptoHashHMAC();
00169 
00170     unsigned char               m_mdValue[XSEC_MAX_HASH_SIZE];      // Final output
00171     unsigned int                m_mdLen;
00172 
00173     ALG_ID                      m_algId;
00174     XSECCryptoHash::HashType    m_hashType;
00175 
00176     HCRYPTPROV                  m_p;
00177     HCRYPTHASH                  m_h;
00178 
00179     unsigned char               m_ipadKeyed[XSEC_MAX_HASH_SIZE];
00180     unsigned char               m_opadKeyed[XSEC_MAX_HASH_SIZE];
00181 
00182     unsigned int                m_blockSize;        // Block size (bytes) for used alg.
00183 
00184     // Internal functions
00185     void eraseKeys();
00186 
00187 };
00188 
00189 #endif /* WINCAPICRYPTOHASHHMAC_INCLUDE */

Generated on Sun Mar 14 21:35:30 2004 for XML-Security-C by doxygen 1.3.2