xrootd
Loading...
Searching...
No Matches
XrdCryptoRSA.hh
Go to the documentation of this file.
1#ifndef __CRYPTO_RSA_H__
2#define __CRYPTO_RSA_H__
3/******************************************************************************/
4/* */
5/* X r d C r y p t o R S A . h h */
6/* */
7/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* Produced by Gerri Ganis for CERN */
9/* */
10/* This file is part of the XRootD software suite. */
11/* */
12/* XRootD is free software: you can redistribute it and/or modify it under */
13/* the terms of the GNU Lesser General Public License as published by the */
14/* Free Software Foundation, either version 3 of the License, or (at your */
15/* option) any later version. */
16/* */
17/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20/* License for more details. */
21/* */
22/* You should have received a copy of the GNU Lesser General Public License */
23/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25/* */
26/* The copyright holder's institutional names and contributor's names may not */
27/* be used to endorse or promote products derived from this software without */
28/* specific prior written permission of the institution or contributor. */
29/******************************************************************************/
30
31/* ************************************************************************** */
32/* */
33/* Abstract interface for RSA PKI functionality. */
34/* Allows to plug-in modules based on different crypto implementation */
35/* (OpenSSL, Botan, ...) */
36/* */
37/* ************************************************************************** */
38
42
43typedef void * XrdCryptoRSAdata;
44
45// ---------------------------------------------------------------------------//
46//
47// RSA interface
48//
49// ---------------------------------------------------------------------------//
51{
52public:
54 virtual ~XrdCryptoRSA() {}
55
56 // Status
57 enum ERSAStatus { kInvalid = 0, kPublic = 1, kComplete = 2};
59 const char *Status(ERSAStatus t = kInvalid) const
60 { return ((t == kInvalid) ? cstatus[status] : cstatus[t]); }
61
62 // Access underlying data (in opaque form)
64
65 // Dump information
66 virtual void Dump();
67
68 // Validity
69 bool IsValid() { return (status != kInvalid); }
70
71 // Output lengths
72 virtual int GetOutlen(int lin); // Length of encrypted buffers
73 virtual int GetPublen(); // Length of export public key
74 virtual int GetPrilen(); // Length of export private key
75
76 // Import / Export methods
77 virtual int ImportPublic(const char *in, int lin);
78 virtual int ExportPublic(char *out, int lout);
80 virtual int ImportPrivate(const char *in, int lin);
81 virtual int ExportPrivate(char *out, int lout);
83
84 // Encryption / Decryption methods
85 virtual int EncryptPrivate(const char *in, int lin, char *out, int lout);
86 virtual int DecryptPublic(const char *in, int lin, char *out, int lout);
87 virtual int EncryptPublic(const char *in, int lin, char *out, int lout);
88 virtual int DecryptPrivate(const char *in, int lin, char *out, int lout);
93
94private:
95 static const char *cstatus[3]; // Names of status
96};
97
98#endif
void * XrdCryptoRSAdata
Definition XrdCryptoRSA.hh:43
Definition XrdCryptoRSA.hh:51
int DecryptPublic(XrdSutBucket &buck)
int ExportPublic(XrdOucString &exp)
static const char * cstatus[3]
Definition XrdCryptoRSA.hh:95
virtual int ExportPublic(char *out, int lout)
virtual void Dump()
ERSAStatus status
Definition XrdCryptoRSA.hh:58
virtual int GetOutlen(int lin)
virtual int DecryptPrivate(const char *in, int lin, char *out, int lout)
virtual int GetPublen()
virtual int GetPrilen()
int DecryptPrivate(XrdSutBucket &buck)
virtual int DecryptPublic(const char *in, int lin, char *out, int lout)
int EncryptPublic(XrdSutBucket &buck)
virtual int EncryptPublic(const char *in, int lin, char *out, int lout)
const char * Status(ERSAStatus t=kInvalid) const
Definition XrdCryptoRSA.hh:59
virtual int ImportPrivate(const char *in, int lin)
virtual XrdCryptoRSAdata Opaque()
int EncryptPrivate(XrdSutBucket &buck)
virtual int EncryptPrivate(const char *in, int lin, char *out, int lout)
virtual int ExportPrivate(char *out, int lout)
bool IsValid()
Definition XrdCryptoRSA.hh:69
int ExportPrivate(XrdOucString &exp)
virtual int ImportPublic(const char *in, int lin)
virtual ~XrdCryptoRSA()
Definition XrdCryptoRSA.hh:54
ERSAStatus
Definition XrdCryptoRSA.hh:57
@ kInvalid
Definition XrdCryptoRSA.hh:57
@ kPublic
Definition XrdCryptoRSA.hh:57
@ kComplete
Definition XrdCryptoRSA.hh:57
XrdCryptoRSA()
Definition XrdCryptoRSA.hh:53
Definition XrdOucString.hh:254
Definition XrdSutBucket.hh:44