|
xrootd
|
00001 #ifndef __CRYPTO_SSLX509CRL_H__ 00002 #define __CRYPTO_SSLX509CRL_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C r y p t o s s l X 5 0 9 C r l . h h */ 00006 /* */ 00007 /* (c) 2005 G. Ganis , CERN */ 00008 /* */ 00009 /* This file is part of the XRootD software suite. */ 00010 /* */ 00011 /* XRootD is free software: you can redistribute it and/or modify it under */ 00012 /* the terms of the GNU Lesser General Public License as published by the */ 00013 /* Free Software Foundation, either version 3 of the License, or (at your */ 00014 /* option) any later version. */ 00015 /* */ 00016 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00017 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00018 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00019 /* License for more details. */ 00020 /* */ 00021 /* You should have received a copy of the GNU Lesser General Public License */ 00022 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00023 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00024 /* */ 00025 /* The copyright holder's institutional names and contributor's names may not */ 00026 /* be used to endorse or promote products derived from this software without */ 00027 /* specific prior written permission of the institution or contributor. */ 00028 /* */ 00029 /******************************************************************************/ 00030 #include <openssl/x509v3.h> 00031 00032 /* ************************************************************************** */ 00033 /* */ 00034 /* OpenSSL X509 CRL implementation . */ 00035 /* */ 00036 /* ************************************************************************** */ 00037 00038 #include "XrdSut/XrdSutCache.hh" 00039 #include "XrdCrypto/XrdCryptoX509Crl.hh" 00040 00041 // ---------------------------------------------------------------------------// 00042 // 00043 // X509 CRL interface 00044 // Describes one CRL certificate 00045 // 00046 // ---------------------------------------------------------------------------// 00047 00048 class XrdSutCache; 00049 class XrdCryptoX509; 00050 00051 class XrdCryptosslX509Crl : public XrdCryptoX509Crl { 00052 public: 00053 00054 XrdCryptosslX509Crl(const char *crlf, int opt = 0); 00055 XrdCryptosslX509Crl(XrdCryptoX509 *cacert); 00056 virtual ~XrdCryptosslX509Crl(); 00057 00058 // Status 00059 bool IsValid() { return (crl != 0); } 00060 00061 // Access underlying data (in opaque form: used in chains) 00062 XrdCryptoX509Crldata Opaque() { return (XrdCryptoX509Crldata)crl; } 00063 00064 // Dump information 00065 void Dump(); 00066 const char *ParentFile() { return (const char *)(srcfile.c_str()); } 00067 00068 // Validity interval 00069 int LastUpdate(); // time when last updated 00070 int NextUpdate(); // time foreseen for next update 00071 00072 // Issuer of top certificate 00073 const char *Issuer(); 00074 const char *IssuerHash(int); // hash 00075 00076 // Chec certificate revocation 00077 bool IsRevoked(int serialnumber, int when = 0); 00078 bool IsRevoked(const char *sernum, int when = 0); 00079 00080 // Verify signature 00081 bool Verify(XrdCryptoX509 *ref); 00082 00083 private: 00084 X509_CRL *crl; // The CRL object 00085 int lastupdate; // time of last update 00086 int nextupdate; // time of next update 00087 XrdOucString issuer; // issuer name; 00088 XrdOucString issuerhash; // hash of issuer name (default algorithm); 00089 XrdOucString issueroldhash; // hash of issuer name (md5 algorithm); 00090 XrdOucString srcfile; // source file name, if any; 00091 XrdOucString crluri; // URI from where to get the CRL file, if any; 00092 00093 int nrevoked; // Number of certificates revoked 00094 XrdSutCache cache; // cached infor about revoked certificates 00095 00096 int GetFileType(const char *crlfn); //Determine file type 00097 int LoadCache(); // Load the cache 00098 int Init(const char *crlf); // Init from file 00099 int InitFromURI(const char *uri, const char *hash); // Init from URI 00100 }; 00101 00102 #endif
1.7.6.1