xrootd
|
00001 // $Id$ 00002 #ifndef __CRYPTO_SSLFACTORY_H__ 00003 #define __CRYPTO_SSLFACTORY_H__ 00004 /******************************************************************************/ 00005 /* */ 00006 /* X r d C r y p t o S s l F a c t o r y . h h */ 00007 /* */ 00008 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00009 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */ 00010 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00011 /* DE-AC03-76-SFO0515 with the Department of Energy */ 00012 /******************************************************************************/ 00013 00014 /* ************************************************************************** */ 00015 /* */ 00016 /* Implementation of the OpenSSL crypto factory */ 00017 /* */ 00018 /* ************************************************************************** */ 00019 00020 #ifndef __CRYPTO_FACTORY_H__ 00021 #include "XrdCrypto/XrdCryptoFactory.hh" 00022 #endif 00023 00024 #include "XrdSys/XrdSysPthread.hh" 00025 00026 int DebugON = 1; 00027 00028 // The ID must be a unique number 00029 #define XrdCryptosslFactoryID 1 00030 00031 #define SSLFACTORY_MAX_CRYPTO_MUTEX 256 00032 00033 class XrdCryptosslFactory : public XrdCryptoFactory 00034 { 00035 public: 00036 XrdCryptosslFactory(); 00037 virtual ~XrdCryptosslFactory() { } 00038 00039 // Set trace flags 00040 void SetTrace(kXR_int32 trace); 00041 00042 // Hook to Key Derivation Function (PBKDF2) 00043 XrdCryptoKDFunLen_t KDFunLen(); // Default Length of buffer 00044 XrdCryptoKDFun_t KDFun(); 00045 00046 // Cipher constructors 00047 bool SupportedCipher(const char *t); 00048 XrdCryptoCipher *Cipher(const char *t, int l = 0); 00049 XrdCryptoCipher *Cipher(const char *t, int l, const char *k, 00050 int liv, const char *iv); 00051 XrdCryptoCipher *Cipher(XrdSutBucket *b); 00052 XrdCryptoCipher *Cipher(int bits, char *pub, int lpub, const char *t = 0); 00053 XrdCryptoCipher *Cipher(const XrdCryptoCipher &c); 00054 00055 // MsgDigest constructors 00056 bool SupportedMsgDigest(const char *dgst); 00057 XrdCryptoMsgDigest *MsgDigest(const char *dgst); 00058 00059 // RSA constructors 00060 XrdCryptoRSA *RSA(int bits = XrdCryptoDefRSABits, int exp = XrdCryptoDefRSAExp); 00061 XrdCryptoRSA *RSA(const char *pub, int lpub = 0); 00062 XrdCryptoRSA *RSA(const XrdCryptoRSA &r); 00063 00064 // X509 constructors 00065 XrdCryptoX509 *X509(const char *cf, const char *kf = 0); 00066 XrdCryptoX509 *X509(XrdSutBucket *b); 00067 00068 // X509 CRL constructor 00069 XrdCryptoX509Crl *X509Crl(const char *crlfile, int opt = 0); 00070 XrdCryptoX509Crl *X509Crl(XrdCryptoX509 *cacert); 00071 00072 // X509 REQ constructors 00073 XrdCryptoX509Req *X509Req(XrdSutBucket *bck); 00074 00075 // Hooks to handle X509 certificates 00076 XrdCryptoX509VerifyCert_t X509VerifyCert(); 00077 XrdCryptoX509VerifyChain_t X509VerifyChain(); 00078 XrdCryptoX509ParseFile_t X509ParseFile(); 00079 XrdCryptoX509ParseBucket_t X509ParseBucket(); 00080 XrdCryptoX509ExportChain_t X509ExportChain(); 00081 XrdCryptoX509ChainToFile_t X509ChainToFile(); 00082 00083 // Required SSL mutexes. 00084 static XrdSysMutex* CryptoMutexPool[SSLFACTORY_MAX_CRYPTO_MUTEX]; 00085 00086 }; 00087 00088 #endif