xrootd
XrdCryptoX509Req.hh
Go to the documentation of this file.
1 #ifndef __CRYPTO_X509REQ_H__
2 #define __CRYPTO_X509REQ_H__
3 /******************************************************************************/
4 /* */
5 /* X r d C r y p t o X 5 0 9 R e q. h h */
6 /* */
7 /* (c) 2005 G. Ganis , CERN */
8 /* */
9 /* This file is part of the XRootD software suite. */
10 /* */
11 /* XRootD is free software: you can redistribute it and/or modify it under */
12 /* the terms of the GNU Lesser General Public License as published by the */
13 /* Free Software Foundation, either version 3 of the License, or (at your */
14 /* option) any later version. */
15 /* */
16 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
17 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
18 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
19 /* License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public License */
22 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
23 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
24 /* */
25 /* The copyright holder's institutional names and contributor's names may not */
26 /* be used to endorse or promote products derived from this software without */
27 /* specific prior written permission of the institution or contributor. */
28 /* */
29 /******************************************************************************/
30 
31 /* ************************************************************************** */
32 /* */
33 /* Abstract interface for X509 certificates. */
34 /* Allows to plug-in modules based on different crypto implementation */
35 /* (OpenSSL, Botan, ...) */
36 /* */
37 /* ************************************************************************** */
38 
39 #include "XrdSut/XrdSutBucket.hh"
41 
42 typedef void * XrdCryptoX509Reqdata;
43 
44 // ---------------------------------------------------------------------------//
45 //
46 // X509 request interface
47 // Describes a one certificate request
48 //
49 // ---------------------------------------------------------------------------//
51 public:
52 
53  XrdCryptoX509Req(int v = -1) { SetVersion(v); }
54  virtual ~XrdCryptoX509Req() { }
55 
56  // Status
57  virtual bool IsValid();
58 
59  // Access underlying data (in opaque form: used in chains)
60  virtual XrdCryptoX509Reqdata Opaque();
61 
62  // Access certificate key
63  virtual XrdCryptoRSA *PKI();
64 
65  // Export in form of bucket (for transfers)
66  virtual XrdSutBucket *Export();
67 
68  // Dump information
69  virtual void Dump();
70 
71  // Subject of bottom certificate
72  virtual const char *Subject();
73  virtual const char *SubjectHash(int); // hash
74  const char *SubjectHash() { return SubjectHash(0); } // hash
75 
76  // Retrieve a given extension if there (in opaque form)
77  virtual XrdCryptoX509Reqdata GetExtension(const char *oid);
78 
79  // Verify signature
80  virtual bool Verify();
81 
82  // Set / Get version
83  int Version() const { return version; }
84  void SetVersion(int v) { version = v; }
85 
86 private:
87  int version; // Version of the plugin producing the request
88 };
89 
90 #endif
Definition: XrdCryptoRSA.hh:50
const char * SubjectHash()
Definition: XrdCryptoX509Req.hh:74
void SetVersion(int v)
Definition: XrdCryptoX509Req.hh:84
int Version() const
Definition: XrdCryptoX509Req.hh:83
virtual XrdCryptoX509Reqdata Opaque()
virtual bool Verify()
virtual XrdSutBucket * Export()
virtual void Dump()
virtual XrdCryptoRSA * PKI()
XrdCryptoX509Req(int v=-1)
Definition: XrdCryptoX509Req.hh:53
Definition: XrdCryptoX509Req.hh:50
virtual ~XrdCryptoX509Req()
Definition: XrdCryptoX509Req.hh:54
void * XrdCryptoX509Reqdata
Definition: XrdCryptoX509Req.hh:42
virtual const char * Subject()
Definition: XrdSutBucket.hh:43
int version
Definition: XrdCryptoX509Req.hh:87
virtual bool IsValid()
virtual XrdCryptoX509Reqdata GetExtension(const char *oid)