00001 // $Id: XrdCryptoCipher.hh 22437 2008-03-04 14:35:16Z rdm $ 00002 #ifndef __CRYPTO_CIPHER_H__ 00003 #define __CRYPTO_CIPHER_H__ 00004 /******************************************************************************/ 00005 /* */ 00006 /* X r d C r y p t o C i p h e r . h h */ 00007 /* */ 00008 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00009 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */ 00010 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00011 /* DE-AC03-76-SFO0515 with the Department of Energy */ 00012 /******************************************************************************/ 00013 00014 /* ************************************************************************** */ 00015 /* */ 00016 /* Abstract interface for a symmetric Cipher functionality. */ 00017 /* Allows to plug-in modules based on different crypto implementation */ 00018 /* (OpenSSL, Botan, ...) */ 00019 /* */ 00020 /* ************************************************************************** */ 00021 00022 #include <XrdSut/XrdSutBucket.hh> 00023 #include <XrdCrypto/XrdCryptoBasic.hh> 00024 00025 // ---------------------------------------------------------------------------// 00026 // 00027 // Cipher interface 00028 // 00029 // ---------------------------------------------------------------------------// 00030 class XrdCryptoCipher : public XrdCryptoBasic 00031 { 00032 public: 00033 XrdCryptoCipher() : XrdCryptoBasic() {} 00034 virtual ~XrdCryptoCipher() {} 00035 00036 // Finalize key computation (key agreement) 00037 virtual bool Finalize(char *pub, int lpub, const char *t); 00038 00039 // Validity 00040 virtual bool IsValid(); 00041 00042 // Required buffer size for encrypt / decrypt operations on l bytes 00043 virtual int EncOutLength(int l); 00044 virtual int DecOutLength(int l); 00045 00046 // Additional getters 00047 virtual XrdSutBucket *AsBucket(); 00048 virtual char *IV(int &l) const; 00049 virtual bool IsDefaultLength() const; 00050 virtual char *Public(int &lpub); 00051 00052 // Additional setters 00053 virtual void SetIV(int l, const char *iv); 00054 00055 // Additional methods 00056 virtual int Encrypt(const char *in, int lin, char *out); 00057 virtual int Decrypt(const char *in, int lin, char *out); 00058 int Encrypt(XrdSutBucket &buck); 00059 int Decrypt(XrdSutBucket &buck); 00060 virtual char *RefreshIV(int &l); 00061 }; 00062 00063 #endif