xrootd
XrdCryptosslAux.hh
Go to the documentation of this file.
00001 #ifndef __CRYPTO_SSLAUX_H__
00002 #define __CRYPTO_SSLAUX_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                  X r d C r y p t o S s l A u x . 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 /* OpenSSL utility functions                                                  */
00034 /*                                                                            */
00035 /* ************************************************************************** */
00036 
00037 #include "XrdCrypto/XrdCryptoAux.hh"
00038 #include "XrdCrypto/XrdCryptoX509Chain.hh"
00039 #include <openssl/asn1.h>
00040 
00041 #define kSslKDFunDefLen  24
00042 
00043 //
00044 // Password-Based Key Derivation Function 2, specified in PKCS #5
00045 //
00046 int XrdCryptosslKDFunLen(); // default buffer length
00047 int XrdCryptosslKDFun(const char *pass, int plen, const char *salt, int slen,
00048                       char *key, int len);
00049 //
00050 // X509 manipulation: certificate verification
00051 bool XrdCryptosslX509VerifyCert(XrdCryptoX509 *c, XrdCryptoX509 *r);
00052 // chain verification
00053 bool XrdCryptosslX509VerifyChain(XrdCryptoX509Chain *chain, int &errcode);
00054 // chain export to bucket
00055 XrdSutBucket *XrdCryptosslX509ExportChain(XrdCryptoX509Chain *c, bool key = 0);
00056 // chain export to file (proxy file creation)
00057 int XrdCryptosslX509ChainToFile(XrdCryptoX509Chain *c, const char *fn);
00058 // certificates from file parsing
00059 int XrdCryptosslX509ParseFile(const char *fname, XrdCryptoX509Chain *c);
00060 // certificates from bucket parsing
00061 int XrdCryptosslX509ParseBucket(XrdSutBucket *b, XrdCryptoX509Chain *c);
00062 //
00063 // Function to convert from ASN1 time format into UTC since Epoch (Jan 1, 1970) 
00064 int XrdCryptosslASN1toUTC(ASN1_TIME *tsn1);
00065 
00066 // Function to convert X509_NAME into a one-line human readable string
00067 void XrdCryptosslNameOneLine(X509_NAME *nm, XrdOucString &s);
00068 
00069 /******************************************************************************/
00070 /*          E r r o r   L o g g i n g / T r a c i n g   F l a g s             */
00071 /******************************************************************************/
00072 #define sslTRACE_ALL       0x0007
00073 #define sslTRACE_Dump      0x0004
00074 #define sslTRACE_Debug     0x0002
00075 #define sslTRACE_Notify    0x0001
00076 
00077 #endif
00078