Qore Programming Language  0.8.7
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreSSLCertificate.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreSSLCertificate.h
4 
5  Qore Programming Language
6 
7  Copyright 2003 - 2013 David Nichols
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 
24 #ifndef _QORE_QORESSLCERTIFICATE_H
25 
26 #define _QORE_QORESSLCERTIFICATE_H
27 
28 #include <qore/QoreSSLBase.h>
29 
30 #include <openssl/ssl.h>
31 #include <openssl/pem.h>
32 
35  private:
37  struct qore_sslcert_private *priv;
38 
39  DLLLOCAL AbstractQoreNode *doPurposeValue(int id, int ca) const;
40 
42  DLLLOCAL QoreSSLCertificate(const QoreSSLCertificate&);
43 
45  DLLLOCAL QoreSSLCertificate& operator=(const QoreSSLCertificate&);
46 
47  protected:
49  DLLLOCAL virtual ~QoreSSLCertificate();
50 
51  public:
53 
55  DLLEXPORT QoreSSLCertificate(X509 *c);
56 
58 
61  DLLEXPORT QoreSSLCertificate(const BinaryNode *bin, ExceptionSink *xsink);
62 
64 
67  DLLEXPORT QoreSSLCertificate(const QoreString *str, ExceptionSink *xsink);
68 
70 
73  DLLLOCAL QoreSSLCertificate(const char *fn, ExceptionSink *xsink);
74 
76  DLLEXPORT operator bool() const;
77 
79 
81  DLLEXPORT QoreStringNode *getPEM(ExceptionSink *xsink) const;
82 
83  // caller does NOT own the X509 pointer returned; "const" cannot be used because of the openssl API does not support it
84  DLLEXPORT X509 *getData() const;
85 
86  // caller owns value returned
87  DLLEXPORT QoreHashNode *getSubjectHash() const;
88 
89  // caller owns value returned
90  DLLEXPORT QoreHashNode *getIssuerHash() const;
91  DLLEXPORT int64 getSerialNumber() const;
92  DLLEXPORT int64 getVersion() const;
93 
94  // caller owns value returned
95  DLLEXPORT QoreHashNode *getPurposeHash() const;
96 
97  // caller owns value returned
98  DLLEXPORT DateTimeNode *getNotBeforeDate() const;
99 
100  // caller owns value returned
101  DLLEXPORT DateTimeNode *getNotAfterDate() const;
102 
103  // caller owns value returned
104  DLLEXPORT QoreStringNode *getSignatureType() const;
105 
106  // caller owns value returned
107  DLLEXPORT BinaryNode *getSignature() const;
108 
109  // caller owns value returned
110  DLLEXPORT QoreStringNode *getPublicKeyAlgorithm() const;
111 
112  // caller owns value returned
113  DLLEXPORT BinaryNode *getPublicKey() const;
114 
115  // caller owns value returned
116  DLLEXPORT QoreHashNode *getInfo() const;
117 };
118 
119 #endif