xrootd
XrdCryptoCipher.hh
Go to the documentation of this file.
1 // $Id$
2 #ifndef __CRYPTO_CIPHER_H__
3 #define __CRYPTO_CIPHER_H__
4 /******************************************************************************/
5 /* */
6 /* X r d C r y p t o C i p h e r . h h */
7 /* */
8 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
9 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */
10 /* Produced by Andrew Hanushevsky for Stanford University under contract */
11 /* DE-AC03-76-SFO0515 with the Department of Energy */
12 /******************************************************************************/
13 
14 /* ************************************************************************** */
15 /* */
16 /* Abstract interface for a symmetric Cipher functionality. */
17 /* Allows to plug-in modules based on different crypto implementation */
18 /* (OpenSSL, Botan, ...) */
19 /* */
20 /* ************************************************************************** */
21 
22 #include <XrdSut/XrdSutBucket.hh>
24 
25 // ---------------------------------------------------------------------------//
26 //
27 // Cipher interface
28 //
29 // ---------------------------------------------------------------------------//
31 {
32 public:
34  virtual ~XrdCryptoCipher() {}
35 
36  // Finalize key computation (key agreement)
37  virtual bool Finalize(char *pub, int lpub, const char *t);
38 
39  // Validity
40  virtual bool IsValid();
41 
42  // Required buffer size for encrypt / decrypt operations on l bytes
43  virtual int EncOutLength(int l);
44  virtual int DecOutLength(int l);
45 
46  // Additional getters
47  virtual XrdSutBucket *AsBucket();
48  virtual char *IV(int &l) const;
49  virtual bool IsDefaultLength() const;
50  virtual char *Public(int &lpub);
51 
52  // Additional setters
53  virtual void SetIV(int l, const char *iv);
54 
55  // Additional methods
56  virtual int Encrypt(const char *in, int lin, char *out);
57  virtual int Decrypt(const char *in, int lin, char *out);
58  int Encrypt(XrdSutBucket &buck);
59  int Decrypt(XrdSutBucket &buck);
60  virtual char *RefreshIV(int &l);
61 };
62 
63 #endif