Loading...
Searching...
No Matches
XrdCryptoRSA Class Reference

`#include <XrdCryptoRSA.hh>`

Inheritance diagram for XrdCryptoRSA:
Collaboration diagram for XrdCryptoRSA:

## Public Types

enum | ERSAStatus { kInvalid = 0 , kPublic = 1 , kComplete = 2 }

## Public Member Functions

| XrdCryptoRSA ()
virtual | ~XrdCryptoRSA ()
virtual int | DecryptPrivate (const char *in, int lin, char *out, int lout)
int | DecryptPrivate (XrdSutBucket &buck)
virtual int | DecryptPublic (const char *in, int lin, char *out, int lout)
int | DecryptPublic (XrdSutBucket &buck)
virtual void | Dump ()
virtual int | EncryptPrivate (const char *in, int lin, char *out, int lout)
int | EncryptPrivate (XrdSutBucket &buck)
virtual int | EncryptPublic (const char *in, int lin, char *out, int lout)
int | EncryptPublic (XrdSutBucket &buck)
virtual int | ExportPrivate (char *out, int lout)
int | ExportPrivate (XrdOucString &exp)
virtual int | ExportPublic (char *out, int lout)
int | ExportPublic (XrdOucString &exp)
virtual int | GetOutlen (int lin)
virtual int | GetPrilen ()
virtual int | GetPublen ()
virtual int | ImportPrivate (const char *in, int lin)
virtual int | ImportPublic (const char *in, int lin)
bool | IsValid ()
virtual XrdCryptoRSAdata | Opaque ()
const char * | Status (ERSAStatus t=kInvalid) const

## Public Attributes

ERSAStatus | status

## Detailed Description

Definition at line 50 of file XrdCryptoRSA.hh.

## Member Enumeration Documentation

## ERSAStatus

enum XrdCryptoRSA::ERSAStatus

Enumerator
kInvalid |
kPublic |
kComplete |

Definition at line 57 of file XrdCryptoRSA.hh.

{ kInvalid = 0, kPublic = 1, kComplete = 2};
XrdCryptoRSA::kInvalid
@ kInvalid
Definition XrdCryptoRSA.hh:57
XrdCryptoRSA::kPublic
@ kPublic
Definition XrdCryptoRSA.hh:57
XrdCryptoRSA::kComplete
@ kComplete
Definition XrdCryptoRSA.hh:57

## Constructor & Destructor Documentation

## XrdCryptoRSA()

XrdCryptoRSA::XrdCryptoRSA | ( |  | ) |

inline

Definition at line 53 of file XrdCryptoRSA.hh.

{ status = kInvalid; }
XrdCryptoRSA::status
ERSAStatus status
Definition XrdCryptoRSA.hh:58

References kInvalid, and status.

Referenced by XrdCryptosslRSA::XrdCryptosslRSA().

Here is the caller graph for this function:

## ~XrdCryptoRSA()

virtual XrdCryptoRSA::~XrdCryptoRSA | ( |  | ) |

inline virtual

Definition at line 54 of file XrdCryptoRSA.hh.

{}

## Member Function Documentation

## DecryptPrivate() [1/2]

int XrdCryptoRSA::DecryptPrivate | ( | const char * | in,
|  | int | lin,
|  | char * | out,
|  | int | lout )

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 173 of file XrdCryptoRSA.cc.

{
// Abstract method to decrypt using the private key
ABSTRACTMETHOD("XrdCryptoRSA::DecryptPrivate");
return -1;
}
ABSTRACTMETHOD
#define ABSTRACTMETHOD(x)
Definition XrdCryptoAux.hh:41

References ABSTRACTMETHOD.

Referenced by DecryptPrivate(), and main().

Here is the caller graph for this function:

## DecryptPrivate() [2/2]

int XrdCryptoRSA::DecryptPrivate | ( | XrdSutBucket & | buck | ) |

Definition at line 229 of file XrdCryptoRSA.cc.

{
// Decrypt bucket bck using the private key
// Return new bucket size, or -1 in case of error
int snew = -1;
int sz = GetOutlen(bck.size);
char *newbuf = new char[sz];
if (newbuf) {
memset(newbuf, 0, sz);
snew = DecryptPrivate(bck.buffer,bck.size,newbuf,sz);
if (snew > -1)
bck.Update(newbuf,snew);
else
delete[] newbuf;
}
return snew;
}
XrdCryptoRSA::GetOutlen
virtual int GetOutlen(int lin)
Definition XrdCryptoRSA.cc:59
XrdCryptoRSA::DecryptPrivate
virtual int DecryptPrivate(const char *in, int lin, char *out, int lout)
Definition XrdCryptoRSA.cc:173

References XrdSutBucket::buffer, DecryptPrivate(), GetOutlen(), XrdSutBucket::size, and XrdSutBucket::Update().

Here is the call graph for this function:

## DecryptPublic() [1/2]

int XrdCryptoRSA::DecryptPublic | ( | const char * | in,
|  | int | lin,
|  | char * | out,
|  | int | lout )

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 181 of file XrdCryptoRSA.cc.

{
// Abstract method to decrypt using the public key
ABSTRACTMETHOD("XrdCryptoRSA::DecryptPublic");
return -1;
}

References ABSTRACTMETHOD.

Referenced by DecryptPublic(), and main().

Here is the caller graph for this function:

## DecryptPublic() [2/2]

int XrdCryptoRSA::DecryptPublic | ( | XrdSutBucket & | buck | ) |

Definition at line 249 of file XrdCryptoRSA.cc.

{
// Decrypt bucket bck using the public key
// Return new bucket size, or -1 in case of error
int snew = -1;
int sz = GetOutlen(bck.size);
char *newbuf = new char[sz];
if (newbuf) {
memset(newbuf, 0, sz);
snew = DecryptPublic(bck.buffer,bck.size,newbuf,sz);
if (snew > -1)
bck.Update(newbuf,snew);
else
delete[] newbuf;
}
return snew;
}
XrdCryptoRSA::DecryptPublic
virtual int DecryptPublic(const char *in, int lin, char *out, int lout)
Definition XrdCryptoRSA.cc:181

References XrdSutBucket::buffer, DecryptPublic(), GetOutlen(), XrdSutBucket::size, and XrdSutBucket::Update().

Here is the call graph for this function:

## Dump()

void XrdCryptoRSA::Dump | ( |  | ) |

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 44 of file XrdCryptoRSA.cc.

{
// Check key validity
ABSTRACTMETHOD("XrdCryptoRSA::Dump");
}

References ABSTRACTMETHOD.

Referenced by main().

Here is the caller graph for this function:

## EncryptPrivate() [1/2]

int XrdCryptoRSA::EncryptPrivate | ( | const char * | in,
|  | int | lin,
|  | char * | out,
|  | int | lout )

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 157 of file XrdCryptoRSA.cc.

{
// Abstract method to encrypt using the private key
ABSTRACTMETHOD("XrdCryptoRSA::EncryptPrivate");
return -1;
}

References ABSTRACTMETHOD.

Referenced by EncryptPrivate(), and main().

Here is the caller graph for this function:

## EncryptPrivate() [2/2]

int XrdCryptoRSA::EncryptPrivate | ( | XrdSutBucket & | buck | ) |

Definition at line 189 of file XrdCryptoRSA.cc.

{
// Encrypt bucket bck using the private key
// Return new bucket size, or -1 in case of error
int snew = -1;
int sz = GetOutlen(bck.size);
char *newbuf = new char[sz];
if (newbuf) {
memset(newbuf, 0, sz);
snew = EncryptPrivate(bck.buffer,bck.size,newbuf,sz);
if (snew > -1)
bck.Update(newbuf,snew);
else
delete[] newbuf;
}
return snew;
}
XrdCryptoRSA::EncryptPrivate
virtual int EncryptPrivate(const char *in, int lin, char *out, int lout)
Definition XrdCryptoRSA.cc:157

References XrdSutBucket::buffer, EncryptPrivate(), GetOutlen(), XrdSutBucket::size, and XrdSutBucket::Update().

Here is the call graph for this function:

## EncryptPublic() [1/2]

int XrdCryptoRSA::EncryptPublic | ( | const char * | in,
|  | int | lin,
|  | char * | out,
|  | int | lout )

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 165 of file XrdCryptoRSA.cc.

{
// Abstract method to encrypt using the public key
ABSTRACTMETHOD("XrdCryptoRSA::EncryptPublic");
return -1;
}

References ABSTRACTMETHOD.

Referenced by EncryptPublic(), and main().

Here is the caller graph for this function:

## EncryptPublic() [2/2]

int XrdCryptoRSA::EncryptPublic | ( | XrdSutBucket & | buck | ) |

Definition at line 209 of file XrdCryptoRSA.cc.

{
// Encrypt bucket bck using the public key
// Return new bucket size, or -1 in case of error
int snew = -1;
int sz = GetOutlen(bck.size);
char *newbuf = new char[sz];
if (newbuf) {
memset(newbuf, 0, sz);
snew = EncryptPublic(bck.buffer,bck.size,newbuf,sz);
if (snew > -1)
bck.Update(newbuf,snew);
else
delete[] newbuf;
}
return snew;
}
XrdCryptoRSA::EncryptPublic
virtual int EncryptPublic(const char *in, int lin, char *out, int lout)
Definition XrdCryptoRSA.cc:165

References XrdSutBucket::buffer, EncryptPublic(), GetOutlen(), XrdSutBucket::size, and XrdSutBucket::Update().

Here is the call graph for this function:

## ExportPrivate() [1/2]

int XrdCryptoRSA::ExportPrivate | ( | char * | out,
|  | int | lout )

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 107 of file XrdCryptoRSA.cc.

{
// Abstract method to export the private key
ABSTRACTMETHOD("XrdCryptoRSA::ExportPrivate");
return -1;
}

References ABSTRACTMETHOD.

Referenced by ExportPrivate(), and main().

Here is the caller graph for this function:

## ExportPrivate() [2/2]

int XrdCryptoRSA::ExportPrivate | ( | XrdOucString & | exp | ) |

Definition at line 136 of file XrdCryptoRSA.cc.

{
// Export the private key into string s
int newlen = GetPrilen();
if (newlen > 0) {
char *newbuf = new char[newlen+1];
if (newbuf) {
memset(newbuf, 0, newlen+1);
if (ExportPrivate(newbuf,newlen+1) > -1) {
s = (const char *)newbuf;
delete[] newbuf;
return 0;
}
delete[] newbuf;
}
}
return -1;
}
XrdCryptoRSA::ExportPrivate
virtual int ExportPrivate(char *out, int lout)
Definition XrdCryptoRSA.cc:107
XrdCryptoRSA::GetPrilen
virtual int GetPrilen()
Definition XrdCryptoRSA.cc:75

References ExportPrivate(), and GetPrilen().

Here is the call graph for this function:

## ExportPublic() [1/2]

int XrdCryptoRSA::ExportPublic | ( | char * | out,
|  | int | lout )

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 91 of file XrdCryptoRSA.cc.

{
// Abstract method to export the public key
ABSTRACTMETHOD("XrdCryptoRSA::ExportPublic");
return -1;
}

References ABSTRACTMETHOD.

Referenced by ExportPublic(), and main().

Here is the caller graph for this function:

## ExportPublic() [2/2]

int XrdCryptoRSA::ExportPublic | ( | XrdOucString & | exp | ) |

Definition at line 115 of file XrdCryptoRSA.cc.

{
// Export the public key into string s
int newlen = GetPublen();
if (newlen > 0) {
char *newbuf = new char[newlen+1];
if (newbuf) {
memset(newbuf, 0, newlen+1);
if (ExportPublic(newbuf,newlen+1) > -1) {
s = (const char *)newbuf;
delete[] newbuf;
return 0;
}
delete[] newbuf;
}
}
return -1;
}
XrdCryptoRSA::GetPublen
virtual int GetPublen()
Definition XrdCryptoRSA.cc:67
XrdCryptoRSA::ExportPublic
virtual int ExportPublic(char *out, int lout)
Definition XrdCryptoRSA.cc:91

References ExportPublic(), and GetPublen().

Here is the call graph for this function:

## GetOutlen()

int XrdCryptoRSA::GetOutlen | ( | int | lin | ) |

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 59 of file XrdCryptoRSA.cc.

{
// Get length of output
ABSTRACTMETHOD("XrdCryptoRSA::GetOutlen");
return 0;
}

References ABSTRACTMETHOD.

Referenced by DecryptPrivate(), DecryptPublic(), EncryptPrivate(), and EncryptPublic().

Here is the caller graph for this function:

## GetPrilen()

int XrdCryptoRSA::GetPrilen | ( |  | ) |

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 75 of file XrdCryptoRSA.cc.

{
// Get length of private key export form
ABSTRACTMETHOD("XrdCryptoRSA::GetPrilen");
return 0;
}

References ABSTRACTMETHOD.

Referenced by ExportPrivate(), and main().

Here is the caller graph for this function:

## GetPublen()

int XrdCryptoRSA::GetPublen | ( |  | ) |

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 67 of file XrdCryptoRSA.cc.

{
// Get length of public key export form
ABSTRACTMETHOD("XrdCryptoRSA::GetPublen");
return 0;
}

References ABSTRACTMETHOD.

Referenced by ExportPublic(), and main().

Here is the caller graph for this function:

## ImportPrivate()

int XrdCryptoRSA::ImportPrivate | ( | const char * | in,
|  | int | lin )

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 99 of file XrdCryptoRSA.cc.

{
// Abstract method to import a private key
ABSTRACTMETHOD("XrdCryptoRSA::ImportPrivate");
return -1;
}

References ABSTRACTMETHOD.

Referenced by main().

Here is the caller graph for this function:

## ImportPublic()

int XrdCryptoRSA::ImportPublic | ( | const char * | in,
|  | int | lin )

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 83 of file XrdCryptoRSA.cc.

{
// Abstract method to import a public key
ABSTRACTMETHOD("XrdCryptoRSA::ImportPublic");
return -1;
}

References ABSTRACTMETHOD.

Referenced by main().

Here is the caller graph for this function:

## IsValid()

bool XrdCryptoRSA::IsValid | ( |  | ) |

inline

Definition at line 69 of file XrdCryptoRSA.hh.

{ return (status != kInvalid); }

References kInvalid, and status.

Referenced by XrdCryptosslRSA::Dump(), XrdCryptosslRSA::ExportPrivate(), XrdCryptosslRSA::ExportPublic(), XrdCryptosslFactory::RSA(), XrdCryptosslFactory::RSA(), and XrdCryptosslFactory::RSA().

Here is the caller graph for this function:

## Opaque()

XrdCryptoRSAdata XrdCryptoRSA::Opaque | ( |  | ) |

virtual

Reimplemented in XrdCryptosslRSA.

Definition at line 51 of file XrdCryptoRSA.cc.

{
// Return underlying key in raw format
ABSTRACTMETHOD("XrdCryptoRSA::Opaque");
return (XrdCryptoRSAdata)0;
}
XrdCryptoRSAdata
void * XrdCryptoRSAdata
Definition XrdCryptoRSA.hh:43

References ABSTRACTMETHOD.

Referenced by main(), XrdCryptosslX509ChainToFile(), and XrdCryptosslX509ExportChain().

Here is the caller graph for this function:

## Status()

const char * XrdCryptoRSA::Status | ( | ERSAStatus | t = kInvalid | ) | const

inline

Definition at line 59 of file XrdCryptoRSA.hh.

{ return ((t == kInvalid) ? cstatus[status] : cstatus[t]); }

References kInvalid, and status.

## Member Data Documentation

## status

ERSAStatus XrdCryptoRSA::status

Definition at line 58 of file XrdCryptoRSA.hh.

Referenced by XrdCryptoRSA(), XrdCryptosslRSA::XrdCryptosslRSA(), XrdCryptosslRSA::XrdCryptosslRSA(), XrdCryptosslRSA::XrdCryptosslRSA(), XrdCryptosslRSA::ImportPrivate(), XrdCryptosslRSA::ImportPublic(), IsValid(), Status(), XrdCryptosslX509ChainToFile(), XrdCryptosslX509ExportChain(), XrdCryptosslX509ParseBucket(), and XrdCryptosslX509ParseFile().

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

- XrdCryptoRSA.hh
- XrdCryptoRSA.cc