xrootd
Loading...
Searching...
No Matches
XrdCryptosslRSA.hh
Go to the documentation of this file.
1#ifndef __CRYPTO_SSLRSA_H__
2#define __CRYPTO_SSLRSA_H__
3/******************************************************************************/
4/* */
5/* X r d C r y p t o S s l 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/* OpenSSL implementation of XrdCryptoRSA */
34/* */
35/* ************************************************************************** */
36
38
39#include <openssl/evp.h>
40
41// ---------------------------------------------------------------------------//
42//
43// RSA interface
44//
45// ---------------------------------------------------------------------------//
47{
48private:
49 EVP_PKEY *fEVP; // The key pair
50 int publen; // Length of export public key
51 int prilen; // Length of export private key
52
53public:
55 XrdCryptosslRSA(const char *pub, int lpub = 0);
56 XrdCryptosslRSA(EVP_PKEY *key, bool check = 1);
59
60 // Access underlying data (in opaque form)
62
63 // Dump information
64 void Dump();
65
66 // Output lengths
67 int GetOutlen(int lin); // Length of encrypted buffers
68 int GetPublen(); // Length of export public key
69 int GetPrilen(); // Length of export private key
70
71 // Import / Export methods
72 int ImportPublic(const char *in, int lin);
73 int ExportPublic(char *out, int lout);
74 int ImportPrivate(const char *in, int lin);
75 int ExportPrivate(char *out, int lout);
76
77 // Encryption / Decryption methods
78 int EncryptPrivate(const char *in, int lin, char *out, int lout);
79 int DecryptPublic(const char *in, int lin, char *out, int lout);
80 int EncryptPublic(const char *in, int lin, char *out, int lout);
81 int DecryptPrivate(const char *in, int lin, char *out, int lout);
82};
83
84#endif
#define XrdCryptoMinRSABits
Definition XrdCryptoAux.hh:52
#define XrdCryptoDefRSAExp
Definition XrdCryptoAux.hh:54
void * XrdCryptoRSAdata
Definition XrdCryptoRSA.hh:43
Definition XrdCryptoRSA.hh:51
Definition XrdCryptosslRSA.hh:47
virtual ~XrdCryptosslRSA()
int EncryptPrivate(const char *in, int lin, char *out, int lout)
int publen
Definition XrdCryptosslRSA.hh:50
int ExportPublic(char *out, int lout)
int ImportPublic(const char *in, int lin)
int prilen
Definition XrdCryptosslRSA.hh:51
XrdCryptosslRSA(int bits=XrdCryptoMinRSABits, int exp=XrdCryptoDefRSAExp)
int DecryptPrivate(const char *in, int lin, char *out, int lout)
EVP_PKEY * fEVP
Definition XrdCryptosslRSA.hh:49
int ExportPrivate(char *out, int lout)
XrdCryptosslRSA(const char *pub, int lpub=0)
XrdCryptosslRSA(EVP_PKEY *key, bool check=1)
int ImportPrivate(const char *in, int lin)
XrdCryptoRSAdata Opaque()
Definition XrdCryptosslRSA.hh:61
int GetOutlen(int lin)
XrdCryptosslRSA(const XrdCryptosslRSA &r)
int EncryptPublic(const char *in, int lin, char *out, int lout)
int DecryptPublic(const char *in, int lin, char *out, int lout)