Loading...
Searching...
No Matches
XrdCryptosslRSA.hh
Go to the documentation of this file.
#ifndef __CRYPTO_SSLRSA_H__
#define __CRYPTO_SSLRSA_H__
/******************************************************************************/
/* */
/* X r d C r y p t o S s l R S A . h h */
/* */
/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
/* Produced by Gerri Ganis for CERN */
/* */
/* This file is part of the XRootD software suite. */
/* */
/* XRootD is free software: you can redistribute it and/or modify it under */
/* the terms of the GNU Lesser General Public License as published by the */
/* Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
/* */
/* The copyright holder's institutional names and contributor's names may not */
/* be used to endorse or promote products derived from this software without */
/* specific prior written permission of the institution or contributor. */
/******************************************************************************/
/* ************************************************************************** */
/* */
/* OpenSSL implementation of XrdCryptoRSA */
/* */
/* ************************************************************************** */
#include "XrdCrypto/XrdCryptoRSA.hh"
#include <openssl/evp.h>
// ---------------------------------------------------------------------------//
//
// RSA interface
//
// ---------------------------------------------------------------------------//
class XrdCryptosslRSA : public XrdCryptoRSA
{
private:
EVP_PKEY *fEVP; // The key pair
int publen; // Length of export public key
int prilen; // Length of export private key
public:
XrdCryptosslRSA(int bits = XrdCryptoMinRSABits, int exp = XrdCryptoDefRSAExp);
XrdCryptosslRSA(const char *pub, int lpub = 0);
XrdCryptosslRSA(EVP_PKEY *key, bool check = 1);
XrdCryptosslRSA(const XrdCryptosslRSA &r);
virtual ~XrdCryptosslRSA();
// Access underlying data (in opaque form)
XrdCryptoRSAdata Opaque() { return fEVP; }
// Dump information
void Dump();
// Output lengths
int GetOutlen(int lin); // Length of encrypted buffers
int GetPublen(); // Length of export public key
int GetPrilen(); // Length of export private key
// Import / Export methods
int ImportPublic(const char *in, int lin);
int ExportPublic(char *out, int lout);
int ImportPrivate(const char *in, int lin);
int ExportPrivate(char *out, int lout);
// Encryption / Decryption methods
int EncryptPrivate(const char *in, int lin, char *out, int lout);
int DecryptPublic(const char *in, int lin, char *out, int lout);
int EncryptPublic(const char *in, int lin, char *out, int lout);
int DecryptPrivate(const char *in, int lin, char *out, int lout);
};
#endif
XrdCryptoMinRSABits
#define XrdCryptoMinRSABits
Definition XrdCryptoAux.hh:52
XrdCryptoDefRSAExp
#define XrdCryptoDefRSAExp
Definition XrdCryptoAux.hh:54
XrdCryptoRSA.hh
XrdCryptoRSAdata
void * XrdCryptoRSAdata
Definition XrdCryptoRSA.hh:43
XrdCryptoRSA::XrdCryptoRSA
XrdCryptoRSA()
Definition XrdCryptoRSA.hh:53
XrdCryptosslRSA::GetPublen
int GetPublen()
Definition XrdCryptosslRSA.cc:372
XrdCryptosslRSA::EncryptPrivate
int EncryptPrivate(const char *in, int lin, char *out, int lout)
Definition XrdCryptosslRSA.cc:497
XrdCryptosslRSA::GetPrilen
int GetPrilen()
Definition XrdCryptosslRSA.cc:434
XrdCryptosslRSA::Dump
void Dump()
Definition XrdCryptosslRSA.cc:349
XrdCryptosslRSA::ExportPublic
int ExportPublic(char *out, int lout)
Definition XrdCryptosslRSA.cc:389
XrdCryptosslRSA::ImportPublic
int ImportPublic(const char *in, int lin)
Definition XrdCryptosslRSA.cc:274
XrdCryptosslRSA::XrdCryptosslRSA
XrdCryptosslRSA(int bits=XrdCryptoMinRSABits, int exp=XrdCryptoDefRSAExp)
Definition XrdCryptosslRSA.cc:87
XrdCryptosslRSA::DecryptPrivate
int DecryptPrivate(const char *in, int lin, char *out, int lout)
Definition XrdCryptosslRSA.cc:607
XrdCryptosslRSA::ExportPrivate
int ExportPrivate(char *out, int lout)
Definition XrdCryptosslRSA.cc:452
XrdCryptosslRSA::ImportPrivate
int ImportPrivate(const char *in, int lin)
Definition XrdCryptosslRSA.cc:314
XrdCryptosslRSA::Opaque
XrdCryptoRSAdata Opaque()
Definition XrdCryptosslRSA.hh:61
XrdCryptosslRSA::GetOutlen
int GetOutlen(int lin)
Definition XrdCryptosslRSA.cc:264
XrdCryptosslRSA::~XrdCryptosslRSA
virtual ~XrdCryptosslRSA()
Definition XrdCryptosslRSA.cc:253
XrdCryptosslRSA::EncryptPublic
int EncryptPublic(const char *in, int lin, char *out, int lout)
Definition XrdCryptosslRSA.cc:552
XrdCryptosslRSA::DecryptPublic
int DecryptPublic(const char *in, int lin, char *out, int lout)
Definition XrdCryptosslRSA.cc:661