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

WinCAPICryptoHash.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 2002-2005 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  * limitations under the License.
00015  */
00016 
00017 /*
00018  * XSEC
00019  *
00020  * WinCAPICryptoHash := Windows CAPI Implementation of Message digests
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: WinCAPICryptoHash.hpp 369191 2006-01-15 09:14:43Z blautenb $
00025  *
00026  */
00027 
00028 #ifndef WINCAPICRYPTOHASH_INCLUDE
00029 #define WINCAPICRYPTOHASH_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 #define WINCAPI_MAX_HASH_SIZE   256
00043 
00044 class WinCAPICryptoProvider;
00045 
00057 class DSIG_EXPORT WinCAPICryptoHash : public XSECCryptoHash {
00058 
00059 
00060 public :
00061 
00075     WinCAPICryptoHash(HCRYPTPROV prov, XSECCryptoHash::HashType alg);
00076     virtual ~WinCAPICryptoHash();
00077 
00079 
00082     
00092     virtual void        setKey(XSECCryptoKey * key) {}
00093 
00095 
00098 
00105     virtual void        reset(void);
00106     
00118     virtual void        hash(unsigned char * data, 
00119                              unsigned int length);
00120 
00133     virtual unsigned int finish(unsigned char * hash,
00134                                 unsigned int maxLength);// Finish and get hash
00135 
00137 
00140 
00149     virtual HashType getHashType(void);
00150 
00152 
00153 private:
00154 
00155     // Not implemented constructors
00156     WinCAPICryptoHash();
00157 
00158     unsigned char               m_mdValue[WINCAPI_MAX_HASH_SIZE];       // Final output
00159     unsigned int                m_mdLen;
00160 
00161     XSECCryptoHash::HashType    m_hashType;
00162 
00163     HCRYPTPROV                  m_p;
00164     HCRYPTHASH                  m_h;
00165 
00166 };
00167 
00168 #endif /* HAVE_WINCAPI */
00169 #endif /* WINCAPICRYPTOHASHSHA1_INCLUDE */

Generated on Sun Jan 28 19:37:23 2007 for XML-Security-C by  doxygen 1.4.2