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

XSECCryptoHash.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  * XSECCryptoProvider := Base virtual class to define a hash algorithm
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: XSECCryptoHash.hpp,v 1.12 2005/06/04 11:30:26 blautenb Exp $
00025  *
00026  */
00027 
00028 #ifndef XSECCRYPTOHASH_INCLUDE
00029 #define XSECCRYPTOHASH_INCLUDE
00030 
00031 #include <xsec/framework/XSECDefs.hpp>
00032 #include <xsec/enc/XSECCryptoKey.hpp>
00033 
00034 #define XSEC_MAX_HASH_SIZE          256     /* Max size of any expected hash algorithms (oversized) */
00035 #define XSEC_MAX_HASH_BLOCK_SIZE    64      /* Max size of blocks used - MD5 and SHA1 are both 64 bytes*/
00036 
00056 class DSIG_EXPORT XSECCryptoHash {
00057 
00058 
00059 public :
00060 
00067     enum HashType {
00068 
00069         HASH_NONE           = 0,
00070         HASH_SHA1           = 1,
00071         HASH_MD5            = 2,
00072         HASH_SHA224         = 3,
00073         HASH_SHA256         = 4,
00074         HASH_SHA384         = 5,
00075         HASH_SHA512         = 6
00076 
00077     };
00078 
00079     // Constructors/Destructors
00080     
00081     XSECCryptoHash() {};
00082     virtual ~XSECCryptoHash() {};
00083 
00086 
00094     virtual void        reset(void) = 0;                    // Reset the hash
00095 
00107     virtual void        hash(unsigned char * data, 
00108                              unsigned int length) = 0;
00109 
00122     virtual unsigned int finish(unsigned char * hash,
00123                                 unsigned int maxLength) = 0;// Finish and get hash
00124 
00126 
00129 
00138     virtual HashType getHashType(void) = 0;
00139 
00141 
00144     
00158     virtual void        setKey(XSECCryptoKey * key) = 0;
00159 
00161 
00162 };
00163 
00164 #endif /* XSECCRYPTOHASH_INCLUDE */

Generated on Sun Jul 3 17:37:28 2005 for XML-Security-C by  doxygen 1.4.2