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

XSECCryptoHash.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  * XSECCryptoProvider := Base virtual class to define a hash algorithm
00021  *
00022  * Author(s): Berin Lautenbach
00023  *
00024  * $Id: XSECCryptoHash.hpp,v 1.9 2004/02/08 10:23:57 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 
00057 class DSIG_EXPORT XSECCryptoHash {
00058 
00059 
00060 public :
00061 
00068     enum HashType {
00069 
00070         HASH_NONE           = 0,
00071         HASH_SHA1           = 1,
00072         HASH_MD5            = 2
00073 
00074     };
00075 
00076     // Constructors/Destructors
00077     
00078     XSECCryptoHash() {};
00079     virtual ~XSECCryptoHash() {};
00080 
00083 
00091     virtual void        reset(void) = 0;                    // Reset the hash
00092 
00104     virtual void        hash(unsigned char * data, 
00105                              unsigned int length) = 0;
00106 
00119     virtual unsigned int finish(unsigned char * hash,
00120                                 unsigned int maxLength) = 0;// Finish and get hash
00121 
00123 
00126 
00135     virtual HashType getHashType(void) = 0;
00136 
00138 
00141     
00155     virtual void        setKey(XSECCryptoKey * key) = 0;
00156 
00158 
00159 };
00160 
00161 #endif /* XSECCRYPTOHASH_INCLUDE */

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