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

NSSCryptoHashHMAC.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  * NSSCryptoHashHMAC := NSS Implementation of HMAC
00021  *
00022  * Author(s): Milan Tomic
00023  *
00024  */
00025 
00026 #ifndef NSSCRYPTOHASHHMAC_INCLUDE
00027 #define NSSCRYPTOHASHHMAC_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 NSSCryptoHashHMAC : public XSECCryptoHash {
00050 
00051 
00052 public :
00053 
00056 
00066     NSSCryptoHashHMAC(XSECCryptoHash::HashType alg);
00067     virtual ~NSSCryptoHashHMAC();
00068 
00070 
00073     
00083     virtual void setKey(XSECCryptoKey * key);
00084 
00086 
00089 
00096     virtual void reset(void);
00097 
00109     virtual void        hash(unsigned char * data, 
00110                              unsigned int length);
00111 
00125     virtual unsigned int finish(unsigned char * hash,
00126                                 unsigned int maxLength);
00127 
00129 
00132 
00141     virtual HashType getHashType(void);
00142 
00144 
00145 private:
00146 
00147     // Not implemented constructors
00148     NSSCryptoHashHMAC();
00149 
00150     unsigned char               m_mdValue[XSEC_MAX_HASH_SIZE];      // Final output
00151     unsigned int                m_mdLen;
00152 
00153     HashType              m_hashType;
00154 
00155   PK11Context *       mp_md;
00156 
00157     unsigned char               m_ipadKeyed[XSEC_MAX_HASH_SIZE];
00158     unsigned char               m_opadKeyed[XSEC_MAX_HASH_SIZE];
00159 
00160     unsigned int                m_blockSize;        // Block size (bytes) for used alg.
00161 
00162   safeBuffer                m_keyBuf;                       // The loaded key
00163     unsigned int            m_keyLen;                       // The loaded key length
00164 
00165 };
00166 
00167 #endif /* HAVE_NSS */
00168 #endif /* NSSCRYPTOHASHHMAC_INCLUDE */

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