Qore Programming Language  0.8.9
 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
DLLEXPORT QoreStringNode * getPEM(ExceptionSink *xsink) const
returns a string in PEM format representing the certificate; caller owns the QoreStringNode reference...
represents an X509 certificate, reference-counted, dynamically-allocated only
Definition: QoreSSLCertificate.h:34
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:41
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:36
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
virtual DLLLOCAL ~QoreSSLCertificate()
the destructor is protected to ensure that it&#39;s only dynamically allocated (use deref() to delete) ...
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:42
Qore&#39;s string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:40
Qore&#39;s parse tree/value type for date-time values, reference-counted, dynamically-allocated only...
Definition: DateTimeNode.h:36
container for holding Qore-language exception information and also for registering a &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:35
offers static functions to help with translating openssl data structures to Qore data structures ...
Definition: QoreSSLBase.h:32
holds arbitrary binary data
Definition: BinaryNode.h:33