00001 #ifndef __CRYPTO_X509REQ_H__ 00002 #define __CRYPTO_X509REQ_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C r y p t o X 5 0 9 R e q. 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 00031 /* ************************************************************************** */ 00032 /* */ 00033 /* Abstract interface for X509 certificates. */ 00034 /* Allows to plug-in modules based on different crypto implementation */ 00035 /* (OpenSSL, Botan, ...) */ 00036 /* */ 00037 /* ************************************************************************** */ 00038 00039 #include "XrdSut/XrdSutBucket.hh" 00040 #include "XrdCrypto/XrdCryptoRSA.hh" 00041 00042 typedef void * XrdCryptoX509Reqdata; 00043 00044 // ---------------------------------------------------------------------------// 00045 // 00046 // X509 request interface 00047 // Describes a one certificate request 00048 // 00049 // ---------------------------------------------------------------------------// 00050 class XrdCryptoX509Req { 00051 public: 00052 00053 XrdCryptoX509Req(int v = -1) { SetVersion(v); } 00054 virtual ~XrdCryptoX509Req() { } 00055 00056 // Status 00057 virtual bool IsValid(); 00058 00059 // Access underlying data (in opaque form: used in chains) 00060 virtual XrdCryptoX509Reqdata Opaque(); 00061 00062 // Access certificate key 00063 virtual XrdCryptoRSA *PKI(); 00064 00065 // Export in form of bucket (for transfers) 00066 virtual XrdSutBucket *Export(); 00067 00068 // Dump information 00069 virtual void Dump(); 00070 00071 // Subject of bottom certificate 00072 virtual const char *Subject(); 00073 virtual const char *SubjectHash(int); // hash 00074 const char *SubjectHash() { return SubjectHash(0); } // hash 00075 00076 // Retrieve a given extension if there (in opaque form) 00077 virtual XrdCryptoX509Reqdata GetExtension(const char *oid); 00078 00079 // Verify signature 00080 virtual bool Verify(); 00081 00082 // Set / Get version 00083 int Version() const { return version; } 00084 void SetVersion(int v) { version = v; } 00085 00086 private: 00087 int version; // Version of the plugin producing the request 00088 }; 00089 00090 #endif