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

NSSCryptoHash.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 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  * NSSCryptoHash := NSS Implementation of Message digests
00021  *
00022  * Author(s): Milan Tomic
00023  *
00024  */
00025 
00026 #ifndef NSSCRYPTOHASH_INCLUDE
00027 #define NSSCRYPTOHASH_INCLUDE
00028 
00029 #include <xsec/framework/XSECDefs.hpp>
00030 #include <xsec/enc/XSECCryptoHash.hpp>
00031 
00032 #if defined (HAVE_NSS)
00033 
00034 #include "nss/pk11func.h"
00035 #include "nss/nss.h"
00036 
00049 class DSIG_EXPORT NSSCryptoHash : public XSECCryptoHash {
00050 
00051 
00052 public :
00053 
00064     NSSCryptoHash(XSECCryptoHash::HashType alg);
00065     virtual ~NSSCryptoHash();
00066 
00068 
00071     
00081     virtual void setKey(XSECCryptoKey * key) {}
00082 
00084 
00087 
00094     virtual void reset(void);
00095     
00107     virtual void        hash(unsigned char * data, 
00108                              unsigned int length);
00109 
00122     virtual unsigned int finish(unsigned char * hash,
00123                                 unsigned int maxLength);// Finish and get hash
00124 
00126 
00129 
00138     virtual HashType getHashType(void);
00139 
00141 
00142 private:
00143 
00144     // Not implemented constructors
00145     NSSCryptoHash();
00146 
00147     unsigned char               m_mdValue[XSEC_MAX_HASH_SIZE];      // Final output
00148     unsigned int                m_mdLen;
00149 
00150     HashType              m_hashType;
00151 
00152   PK11Context *       mp_md;
00153 
00154 };
00155 
00156 #endif /* HAVE_NSS */
00157 #endif /* NSSCRYPTOHASHSHA1_INCLUDE */

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