xrootd
XrdCryptosslX509Crl.hh
Go to the documentation of this file.
1 // $Id$
2 #ifndef __CRYPTO_SSLX509CRL_H__
3 #define __CRYPTO_SSLX509CRL_H__
4 /******************************************************************************/
5 /* */
6 /* X r d C r y p t o s s l X 5 0 9 C r l . h h */
7 /* */
8 /* */
9 /* (c) 2005 G. Ganis , CERN */
10 /* */
11 /******************************************************************************/
12 #include <openssl/x509v3.h>
13 
14 /* ************************************************************************** */
15 /* */
16 /* OpenSSL X509 CRL implementation . */
17 /* */
18 /* ************************************************************************** */
19 
20 #include <XrdSut/XrdSutCache.hh>
22 
23 // ---------------------------------------------------------------------------//
24 //
25 // X509 CRL interface
26 // Describes one CRL certificate
27 //
28 // ---------------------------------------------------------------------------//
29 
30 class XrdSutCache;
31 class XrdCryptoX509;
32 
34 public:
35 
36  XrdCryptosslX509Crl(const char *crlf, int opt = 0);
38  virtual ~XrdCryptosslX509Crl();
39 
40  // Status
41  bool IsValid() { return (crl != 0); }
42 
43  // Access underlying data (in opaque form: used in chains)
45 
46  // Dump information
47  void Dump();
48  const char *ParentFile() { return (const char *)(srcfile.c_str()); }
49 
50  // Validity interval
51  int LastUpdate(); // time when last updated
52  int NextUpdate(); // time foreseen for next update
53 
54  // Issuer of top certificate
55  const char *Issuer();
56  const char *IssuerHash(); // hash
57 
58  // Chec certificate revocation
59  bool IsRevoked(int serialnumber, int when = 0);
60  bool IsRevoked(const char *sernum, int when = 0);
61 
62  // Verify signature
63  bool Verify(XrdCryptoX509 *ref);
64 
65 private:
66  X509_CRL *crl; // The CRL object
67  int lastupdate; // time of last update
68  int nextupdate; // time of next update
69  XrdOucString issuer; // issuer name;
70  XrdOucString issuerhash; // hash of issuer name;
71  XrdOucString srcfile; // source file name, if any;
72  XrdOucString crluri; // URI from where to get the CRL file, if any;
73 
74  int nrevoked; // Number of certificates revoked
75  XrdSutCache cache; // cached infor about revoked certificates
76 
77  int GetFileType(const char *crlfn); //Determine file type
78  int LoadCache(); // Load the cache
79  int Init(const char *crlf); // Init from file
80  int InitFromURI(const char *uri, const char *hash); // Init from URI
81 };
82 
83 #endif