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

OpenSSLCryptoHash.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  * OpenSSLCryptoHash := OpenSSL Implementation of SHA1
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: OpenSSLCryptoHash.hpp,v 1.6 2004/02/08 10:22:50 blautenb Exp $
00025  *
00026  */
00027 
00028 #ifndef OPENSSLCRYPTOHASHSHA1_INCLUDE
00029 #define OPENSSLCRYPTOHASHSHA1_INCLUDE
00030 
00031 #include <xsec/framework/XSECDefs.hpp>
00032 #include <xsec/enc/XSECCryptoHash.hpp>
00033 
00034 // OpenSSL Includes
00035 
00036 #if defined (HAVE_OPENSSL)
00037 
00038 #   include <openssl/evp.h>
00039 
00053 class DSIG_EXPORT OpenSSLCryptoHash : public XSECCryptoHash {
00054 
00055 public :
00056 
00059 
00060     OpenSSLCryptoHash(XSECCryptoHash::HashType alg);
00061     virtual ~OpenSSLCryptoHash();
00062     
00064 
00067     
00077     virtual void        setKey(XSECCryptoKey * key) {}
00078 
00080 
00083 
00090     virtual void        reset(void);
00091 
00103     virtual void        hash(unsigned char * data, 
00104                              unsigned int length);
00117     virtual unsigned int finish(unsigned char * hash,
00118                                 unsigned int maxLength);// Finish and get hash
00119 
00121 
00124 
00133     virtual HashType getHashType(void);
00134 
00136 
00137 
00138 private:
00139 
00140     // Not implemented constructors
00141     OpenSSLCryptoHash();
00142 
00143     EVP_MD_CTX          m_mdctx;                        // Context for digest
00144     const EVP_MD        * mp_md;                        // Digest instance
00145     unsigned char       m_mdValue[EVP_MAX_MD_SIZE];     // Final output
00146     unsigned int        m_mdLen;                        // Length of digest
00147     HashType            m_hashType;                     // What type of hash is this?
00148 
00149 };
00150 
00151 #endif /* HAVE_OPENSSL */
00152 #endif /* OPENSSLCRYPTOHASHSHA1_INCLUDE */

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