XRootD
Loading...
Searching...
No Matches
XrdCryptoCipher Class Reference

#include <XrdCryptoCipher.hh>

Inheritance diagram for XrdCryptoCipher:
Collaboration diagram for XrdCryptoCipher:

Public Member Functions

 XrdCryptoCipher ()
virtual ~XrdCryptoCipher ()
virtual XrdSutBucketAsBucket ()
virtual int DecOutLength (int l)
virtual int Decrypt (const char *in, int lin, char *out)
int Decrypt (XrdSutBucket &buck, bool useiv=true)
virtual int EncOutLength (int l)
virtual int Encrypt (const char *in, int lin, char *out)
int Encrypt (XrdSutBucket &buck, bool useiv=true)
virtual bool Finalize (bool padded, char *pub, int lpub, const char *t)
bool Finalize (char *pub, int lpub, const char *t)
virtual bool IsDefaultLength () const
virtual bool IsValid ()
virtual char * IV (int &l) const
virtual int MaxIVLength () const
virtual char * Public (int &lpub)
virtual char * RefreshIV (int &l)
virtual void SetIV (int l, const char *iv)
Public Member Functions inherited from XrdCryptoBasic
 XrdCryptoBasic (const char *t=0, int l=0, const char *b=0)
virtual ~XrdCryptoBasic ()
char * AsHexString ()
virtual char * Buffer () const
virtual int FromHex (const char *hex)
virtual int Length () const
virtual int SetBuffer (int l, const char *b)
virtual int SetLength (int l)
virtual int SetType (const char *t)
virtual char * Type () const
virtual void UseBuffer (int l, const char *b)

Detailed Description

Definition at line 47 of file XrdCryptoCipher.hh.

Constructor & Destructor Documentation

◆ XrdCryptoCipher()

XrdCryptoCipher::XrdCryptoCipher ( )
inline

Definition at line 50 of file XrdCryptoCipher.hh.

50: XrdCryptoBasic() {}
XrdCryptoBasic(const char *t=0, int l=0, const char *b=0)

References XrdCryptoBasic::XrdCryptoBasic().

Referenced by XrdCryptosslCipher::XrdCryptosslCipher().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~XrdCryptoCipher()

virtual XrdCryptoCipher::~XrdCryptoCipher ( )
inlinevirtual

Definition at line 51 of file XrdCryptoCipher.hh.

51{}

Member Function Documentation

◆ AsBucket()

XrdSutBucket * XrdCryptoCipher::AsBucket ( )
virtual

Reimplemented from XrdCryptoBasic.

Reimplemented in XrdCryptosslCipher.

Definition at line 94 of file XrdCryptoCipher.cc.

95{
96 // Return pointer to a bucket created using the internal information
97 // serialized
98
99 ABSTRACTMETHOD("XrdCryptoCipher::AsBucket");
100 return 0;
101}
#define ABSTRACTMETHOD(x)

References ABSTRACTMETHOD.

◆ DecOutLength()

int XrdCryptoCipher::DecOutLength ( int l)
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 130 of file XrdCryptoCipher.cc.

131{
132 // Required buffer size for decrypting l bytes
133
134 ABSTRACTMETHOD("XrdCryptoCipher::DecOutLength");
135 return 0;
136}

References ABSTRACTMETHOD.

Referenced by Decrypt(), and main().

Here is the caller graph for this function:

◆ Decrypt() [1/2]

int XrdCryptoCipher::Decrypt ( const char * in,
int lin,
char * out )
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 112 of file XrdCryptoCipher.cc.

113{
114 // Decrypt lin bytes at in with local cipher.
115
116 ABSTRACTMETHOD("XrdCryptoCipher::Decrypt");
117 return 0;
118}

References ABSTRACTMETHOD.

Referenced by Decrypt(), and main().

Here is the caller graph for this function:

◆ Decrypt() [2/2]

int XrdCryptoCipher::Decrypt ( XrdSutBucket & buck,
bool useiv = true )

Definition at line 183 of file XrdCryptoCipher.cc.

184{
185 // Decrypt bucket bck with local cipher
186 // Return size of encoded bucket or -1 in case of error
187 int snew = -1;
188
189 int liv = (useiv) ? MaxIVLength() : 0;
190
191 int sz = DecOutLength(bck.size - liv);
192 char *newbck = new char[sz];
193 if (newbck) {
194
195 if (useiv) {
196 char *iv = new char[liv];
197 if (iv) {
198 memcpy(iv,bck.buffer,liv);
199 SetIV(liv, iv);
200 delete[] iv;
201 } else {
202 return snew;
203 }
204 }
205 memset(newbck, 0, sz);
206 snew = Decrypt(bck.buffer + liv, bck.size - liv, newbck);
207 if (snew > -1)
208 bck.Update(newbck,snew);
209 }
210 return snew;
211}
virtual void SetIV(int l, const char *iv)
virtual int Decrypt(const char *in, int lin, char *out)
virtual int DecOutLength(int l)
virtual int MaxIVLength() const

References XrdSutBucket::buffer, DecOutLength(), Decrypt(), MaxIVLength(), SetIV(), XrdSutBucket::size, and XrdSutBucket::Update().

Here is the call graph for this function:

◆ EncOutLength()

int XrdCryptoCipher::EncOutLength ( int l)
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 121 of file XrdCryptoCipher.cc.

122{
123 // Required buffer size for encrypting l bytes
124
125 ABSTRACTMETHOD("XrdCryptoCipher::EncOutLength");
126 return 0;
127}

References ABSTRACTMETHOD.

Referenced by Encrypt(), and main().

Here is the caller graph for this function:

◆ Encrypt() [1/2]

int XrdCryptoCipher::Encrypt ( const char * in,
int lin,
char * out )
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 103 of file XrdCryptoCipher.cc.

104{
105 // Encrypt lin bytes at in with local cipher.
106
107 ABSTRACTMETHOD("XrdCryptoCipher::Encrypt");
108 return 0;
109}

References ABSTRACTMETHOD.

Referenced by Encrypt(), and main().

Here is the caller graph for this function:

◆ Encrypt() [2/2]

int XrdCryptoCipher::Encrypt ( XrdSutBucket & buck,
bool useiv = true )

Definition at line 157 of file XrdCryptoCipher.cc.

158{
159 // Encrypt bucket bck with local cipher
160 // Return size of encoded bucket or -1 in case of error
161 int snew = -1;
162
163 int liv = 0;
164 char *iv = 0;
165 if (useiv) {
166 iv = RefreshIV(liv);
167 if (!iv) return snew;
168 }
169
170 int sz = EncOutLength(bck.size) + liv;
171 char *newbck = new char[sz];
172 if (newbck) {
173 memset(newbck, 0, sz);
174 if (liv > 0) memcpy(newbck, iv, liv);
175 snew = Encrypt(bck.buffer,bck.size,newbck+liv);
176 if (snew > -1)
177 bck.Update(newbck,snew + liv);
178 }
179 return snew;
180}
virtual char * RefreshIV(int &l)
virtual int Encrypt(const char *in, int lin, char *out)
virtual int EncOutLength(int l)

References XrdSutBucket::buffer, EncOutLength(), Encrypt(), RefreshIV(), XrdSutBucket::size, and XrdSutBucket::Update().

Here is the call graph for this function:

◆ Finalize() [1/2]

bool XrdCryptoCipher::Finalize ( bool padded,
char * pub,
int lpub,
const char * t )
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 43 of file XrdCryptoCipher.cc.

44{
45 // Finalize key computation (key agreement)
46 ABSTRACTMETHOD("XrdCryptoCipher::Finalize");
47 return 0;
48}

References ABSTRACTMETHOD.

Referenced by Finalize(), and main().

Here is the caller graph for this function:

◆ Finalize() [2/2]

bool XrdCryptoCipher::Finalize ( char * pub,
int lpub,
const char * t )
inline

Definition at line 55 of file XrdCryptoCipher.hh.

56 { return Finalize(false, pub, lpub, t); }
virtual bool Finalize(bool padded, char *pub, int lpub, const char *t)

References Finalize().

Here is the call graph for this function:

◆ IsDefaultLength()

bool XrdCryptoCipher::IsDefaultLength ( ) const
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 139 of file XrdCryptoCipher.cc.

140{
141 // Test if cipher length is the default one
142
143 ABSTRACTMETHOD("XrdCryptoCipher::IsDefaultLength");
144 return 0;
145}

References ABSTRACTMETHOD.

◆ IsValid()

bool XrdCryptoCipher::IsValid ( )
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 51 of file XrdCryptoCipher.cc.

52{
53 // Check key validity
54 ABSTRACTMETHOD("XrdCryptoCipher::IsValid");
55 return 0;
56}

References ABSTRACTMETHOD.

Referenced by XrdCryptosslFactory::Cipher(), XrdCryptosslFactory::Cipher(), XrdCryptosslFactory::Cipher(), XrdCryptosslFactory::Cipher(), XrdCryptosslFactory::Cipher(), XrdCryptosslFactory::Cipher(), and main().

Here is the caller graph for this function:

◆ IV()

char * XrdCryptoCipher::IV ( int & l) const
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 76 of file XrdCryptoCipher.cc.

77{
78 // Get IV
79
80 ABSTRACTMETHOD("XrdCryptoCipher::IV");
81 return 0;
82}

References ABSTRACTMETHOD.

◆ MaxIVLength()

int XrdCryptoCipher::MaxIVLength ( ) const
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 148 of file XrdCryptoCipher.cc.

149{
150 // Return the max cipher IV length
151
152 ABSTRACTMETHOD("XrdCryptoCipher::MaxIVLength");
153 return 0;
154}

References ABSTRACTMETHOD.

Referenced by Decrypt().

Here is the caller graph for this function:

◆ Public()

char * XrdCryptoCipher::Public ( int & lpub)
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 85 of file XrdCryptoCipher.cc.

86{
87 // Getter for public part during key agreement
88
89 ABSTRACTMETHOD("XrdCryptoCipher::Public");
90 return 0;
91}

References ABSTRACTMETHOD.

Referenced by main().

Here is the caller graph for this function:

◆ RefreshIV()

char * XrdCryptoCipher::RefreshIV ( int & l)
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 67 of file XrdCryptoCipher.cc.

68{
69 // Regenerate IV and return it
70
71 ABSTRACTMETHOD("XrdCryptoCipher::RefreshIV");
72 return 0;
73}

References ABSTRACTMETHOD.

Referenced by Encrypt().

Here is the caller graph for this function:

◆ SetIV()

void XrdCryptoCipher::SetIV ( int l,
const char * iv )
virtual

Reimplemented in XrdCryptosslCipher.

Definition at line 59 of file XrdCryptoCipher.cc.

60{
61 // Set IV from l bytes at iv. If !iv, sets the IV length.
62
63 ABSTRACTMETHOD("XrdCryptoCipher::SetIV");
64}

References ABSTRACTMETHOD.

Referenced by Decrypt().

Here is the caller graph for this function:

The documentation for this class was generated from the following files: