xrootd
XrdCryptosslFactory.hh
Go to the documentation of this file.
00001 #ifndef __CRYPTO_SSLFACTORY_H__
00002 #define __CRYPTO_SSLFACTORY_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*               X r d C r y p t o S s l F a c t o r y . h h                  */
00006 /*                                                                            */
00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*   Produced by Gerri Ganis for CERN                                         */
00009 /*                                                                            */
00010 /* This file is part of the XRootD software suite.                            */
00011 /*                                                                            */
00012 /* XRootD is free software: you can redistribute it and/or modify it under    */
00013 /* the terms of the GNU Lesser General Public License as published by the     */
00014 /* Free Software Foundation, either version 3 of the License, or (at your     */
00015 /* option) any later version.                                                 */
00016 /*                                                                            */
00017 /* XRootD is distributed in the hope that it will be useful, but WITHOUT      */
00018 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or      */
00019 /* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public       */
00020 /* License for more details.                                                  */
00021 /*                                                                            */
00022 /* You should have received a copy of the GNU Lesser General Public License   */
00023 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file  */
00024 /* COPYING (GPL license).  If not, see <http://www.gnu.org/licenses/>.        */
00025 /*                                                                            */
00026 /* The copyright holder's institutional names and contributor's names may not */
00027 /* be used to endorse or promote products derived from this software without  */
00028 /* specific prior written permission of the institution or contributor.       */
00029 /******************************************************************************/
00030 
00031 /* ************************************************************************** */
00032 /*                                                                            */
00033 /* Implementation of the OpenSSL crypto factory                               */
00034 /*                                                                            */
00035 /* ************************************************************************** */
00036 
00037 #ifndef __CRYPTO_FACTORY_H__
00038 #include "XrdCrypto/XrdCryptoFactory.hh"
00039 #endif
00040 
00041 #include "XrdSys/XrdSysPthread.hh"
00042 
00043 int DebugON = 1;
00044 
00045 // The ID must be a unique number
00046 #define XrdCryptosslFactoryID  1
00047 
00048 #define SSLFACTORY_MAX_CRYPTO_MUTEX 256
00049 
00050 class XrdCryptosslFactory : public XrdCryptoFactory 
00051 {
00052 public:
00053    XrdCryptosslFactory();
00054    virtual ~XrdCryptosslFactory() { }
00055 
00056    // Set trace flags
00057    void SetTrace(kXR_int32 trace);
00058 
00059    // Hook to Key Derivation Function (PBKDF2)
00060    XrdCryptoKDFunLen_t KDFunLen(); // Default Length of buffer
00061    XrdCryptoKDFun_t KDFun();
00062 
00063    // Cipher constructors
00064    bool SupportedCipher(const char *t);
00065    XrdCryptoCipher *Cipher(const char *t, int l = 0);
00066    XrdCryptoCipher *Cipher(const char *t, int l, const char *k,
00067                                           int liv, const char *iv);
00068    XrdCryptoCipher *Cipher(XrdSutBucket *b);
00069    XrdCryptoCipher *Cipher(int bits, char *pub, int lpub, const char *t = 0);
00070    XrdCryptoCipher *Cipher(const XrdCryptoCipher &c);
00071 
00072    // MsgDigest constructors
00073    bool SupportedMsgDigest(const char *dgst);
00074    XrdCryptoMsgDigest *MsgDigest(const char *dgst);
00075 
00076    // RSA constructors
00077    XrdCryptoRSA *RSA(int bits = XrdCryptoDefRSABits, int exp = XrdCryptoDefRSAExp);
00078    XrdCryptoRSA *RSA(const char *pub, int lpub = 0);
00079    XrdCryptoRSA *RSA(const XrdCryptoRSA &r);
00080 
00081    // X509 constructors
00082    XrdCryptoX509 *X509(const char *cf, const char *kf = 0);
00083    XrdCryptoX509 *X509(XrdSutBucket *b);
00084 
00085    // X509 CRL constructor
00086    XrdCryptoX509Crl *X509Crl(const char *crlfile, int opt = 0);
00087    XrdCryptoX509Crl *X509Crl(XrdCryptoX509 *cacert);
00088 
00089    // X509 REQ constructors
00090    XrdCryptoX509Req *X509Req(XrdSutBucket *bck);
00091 
00092    // Hooks to handle X509 certificates
00093    XrdCryptoX509VerifyCert_t X509VerifyCert();
00094    XrdCryptoX509VerifyChain_t X509VerifyChain();
00095    XrdCryptoX509ParseFile_t X509ParseFile();
00096    XrdCryptoX509ParseBucket_t X509ParseBucket();
00097    XrdCryptoX509ExportChain_t X509ExportChain();
00098    XrdCryptoX509ChainToFile_t X509ChainToFile();
00099 
00100    // Required SSL mutexes.
00101   static  XrdSysMutex*              CryptoMutexPool[SSLFACTORY_MAX_CRYPTO_MUTEX];
00102 
00103 };
00104 
00105 #endif