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

XSECCryptoSymmetricKey.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  * 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.8 2004/02/08 10:23:57 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 
00053 class DSIG_EXPORT XSECCryptoSymmetricKey : public XSECCryptoKey {
00054 
00055 public :
00056 
00064     enum SymmetricKeyType {
00065 
00066         KEY_NONE,
00067         KEY_3DES_192,           
00068         KEY_AES_128,            
00069         KEY_AES_192,            
00070         KEY_AES_256             
00072     };
00073 
00074     enum SymmetricKeyMode {
00075 
00076         MODE_NONE,                  
00077         MODE_ECB,                   
00078         MODE_CBC                    
00080     };
00081 
00082 
00085     
00090     XSECCryptoSymmetricKey() {};
00091 
00099     virtual ~XSECCryptoSymmetricKey() {};
00100 
00102 
00105 
00110     virtual KeyType getKeyType() {return KEY_SYMMETRIC;}
00111 
00116     virtual const XMLCh * getProviderName() = 0;
00117 
00126     virtual XSECCryptoKey * clone() = 0;
00127 
00129 
00132 
00141     virtual SymmetricKeyType getSymmetricKeyType(void) = 0;
00142 
00154     virtual void setKey(const unsigned char * key, unsigned int keyLen) = 0;
00155 
00173     virtual bool decryptInit(bool doPad = true,
00174                              SymmetricKeyMode mode = MODE_CBC,
00175                              const unsigned char * iv = NULL) = 0;
00176 
00197     virtual unsigned int decrypt(const unsigned char * inBuf, 
00198                                  unsigned char * plainBuf, 
00199                                  unsigned int inLength,
00200                                  unsigned int maxOutLength) = 0;
00201 
00217     virtual unsigned int decryptFinish(unsigned char * plainBuf,
00218                                        unsigned int maxOutLength) = 0;
00219 
00236     virtual bool encryptInit(bool doPad = true, 
00237                              SymmetricKeyMode mode = MODE_CBC,
00238                              const unsigned char * iv = NULL) = 0;
00239 
00260     virtual unsigned int encrypt(const unsigned char * inBuf, 
00261                                  unsigned char * cipherBuf, 
00262                                  unsigned int inLength,
00263                                  unsigned int maxOutLength) = 0;
00264 
00286     virtual unsigned int encryptFinish(unsigned char * plainBuf,
00287                                        unsigned int maxOutLength) = 0;
00288 
00290 
00291 };
00292 
00293 
00294 #endif /* XSECCRYPTOSYMMETRICKEY_INCLUDE */

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