xrootd
XrdCryptosslX509Req.hh
Go to the documentation of this file.
00001 #ifndef __CRYPTO_SSLX509REQ_H__
00002 #define __CRYPTO_SSLX509REQ_H__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*               X r d C r y p t o s s l 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 /* OpenSSL implementation of XrdCryptoX509                                    */
00034 /*                                                                            */
00035 /* ************************************************************************** */
00036 
00037 #include "XrdCrypto/XrdCryptoX509Req.hh"
00038 
00039 #include <openssl/x509v3.h>
00040 #include <openssl/bio.h>
00041 
00042 // ---------------------------------------------------------------------------//
00043 //
00044 // OpenSSL X509 request implementation
00045 //
00046 // ---------------------------------------------------------------------------//
00047 class XrdCryptosslX509Req : public XrdCryptoX509Req
00048 {
00049 
00050 public:
00051    XrdCryptosslX509Req(XrdSutBucket *bck);
00052    XrdCryptosslX509Req(X509_REQ *creq);
00053    virtual ~XrdCryptosslX509Req();
00054 
00055    // Access underlying data (in opaque form: used in chains)
00056    XrdCryptoX509Reqdata Opaque() { return (XrdCryptoX509Reqdata)creq; }
00057 
00058    // Access certificate key
00059    XrdCryptoRSA *PKI() { return pki; }
00060 
00061    // Export in form of bucket (for transfers)
00062    XrdSutBucket *Export();
00063 
00064    // Relevant Names
00065    const char *Subject();  // get subject name
00066 
00067    // Relevant hashes
00068    const char *SubjectHash(int);  // get hash of subject name
00069 
00070    // Retrieve a given extension if there (in opaque form)
00071    XrdCryptoX509Reqdata GetExtension(const char *oid);
00072 
00073    // Verify signature
00074    bool        Verify();
00075 
00076 private:
00077    X509_REQ    *creq;       // The certificate request object
00078    XrdOucString subject;    // subject;
00079    XrdOucString subjecthash; // hash of subject (default algorithm);
00080    XrdOucString subjectoldhash; // hash of subject (md5 algorithm);
00081    XrdSutBucket *bucket;    // Bucket for export operations
00082    XrdCryptoRSA *pki;       // PKI of the certificate
00083 };
00084 
00085 #endif