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

XSECCryptoSymmetricKey.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  * XSECCryptoSymmetricKey := Bulk encryption algorithms should all be
00021  *                          implemented via this interface
00022  *
00023  * Author(s): Berin Lautenbach
00024  *
00025  * $Id: XSECCryptoSymmetricKey.hpp,v 1.10 2005/06/04 11:30:26 blautenb Exp $
00026  *
00027  */
00028 
00029 
00030 
00031 #ifndef XSECCRYPTOSYMMETRICKEY_INCLUDE
00032 #define XSECCRYPTOSYMMETRICKEY_INCLUDE
00033 
00034 #include <xsec/framework/XSECDefs.hpp>
00035 #include <xsec/dsig/DSIGConstants.hpp>
00036 #include <xsec/enc/XSECCryptoKey.hpp>
00037 
00052 class DSIG_EXPORT XSECCryptoSymmetricKey : public XSECCryptoKey {
00053 
00054 public :
00055 
00063     enum SymmetricKeyType {
00064 
00065         KEY_NONE,
00066         KEY_3DES_192,           
00067         KEY_AES_128,            
00068         KEY_AES_192,            
00069         KEY_AES_256             
00071     };
00072 
00073     enum SymmetricKeyMode {
00074 
00075         MODE_NONE,                  
00076         MODE_ECB,                   
00077         MODE_CBC                    
00079     };
00080 
00081 
00084     
00089     XSECCryptoSymmetricKey() {};
00090 
00098     virtual ~XSECCryptoSymmetricKey() {};
00099 
00101 
00104 
00109     virtual KeyType getKeyType() {return KEY_SYMMETRIC;}
00110 
00115     virtual const XMLCh * getProviderName() = 0;
00116 
00125     virtual XSECCryptoKey * clone() = 0;
00126 
00128 
00131 
00140     virtual SymmetricKeyType getSymmetricKeyType(void) = 0;
00141 
00153     virtual void setKey(const unsigned char * key, unsigned int keyLen) = 0;
00154 
00172     virtual bool decryptInit(bool doPad = true,
00173                              SymmetricKeyMode mode = MODE_CBC,
00174                              const unsigned char * iv = NULL) = 0;
00175 
00196     virtual unsigned int decrypt(const unsigned char * inBuf, 
00197                                  unsigned char * plainBuf, 
00198                                  unsigned int inLength,
00199                                  unsigned int maxOutLength) = 0;
00200 
00216     virtual unsigned int decryptFinish(unsigned char * plainBuf,
00217                                        unsigned int maxOutLength) = 0;
00218 
00235     virtual bool encryptInit(bool doPad = true, 
00236                              SymmetricKeyMode mode = MODE_CBC,
00237                              const unsigned char * iv = NULL) = 0;
00238 
00259     virtual unsigned int encrypt(const unsigned char * inBuf, 
00260                                  unsigned char * cipherBuf, 
00261                                  unsigned int inLength,
00262                                  unsigned int maxOutLength) = 0;
00263 
00285     virtual unsigned int encryptFinish(unsigned char * plainBuf,
00286                                        unsigned int maxOutLength) = 0;
00287 
00289 
00290 };
00291 
00292 
00293 #endif /* XSECCRYPTOSYMMETRICKEY_INCLUDE */

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