QoreSSLCertificate.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreSSLCertificate.h
Qore Programming Language
Copyright (C) 2003 - 2018 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Note that the Qore library is released under a choice of three open-source
licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
information.
*/
#ifndef _QORE_QORESSLCERTIFICATE_H
#define _QORE_QORESSLCERTIFICATE_H
#include <qore/QoreSSLBase.h>
#include <openssl/ssl.h>
#include <openssl/pem.h>
class QoreSSLCertificate : public AbstractPrivateData, public QoreSSLBase {
public:
DLLEXPORT QoreSSLCertificate(X509* c);
DLLEXPORT QoreSSLCertificate(const BinaryNode* bin, ExceptionSink* xsink);
DLLEXPORT QoreSSLCertificate(const QoreString* str, ExceptionSink* xsink);
DLLLOCAL QoreSSLCertificate(const char* fn, ExceptionSink* xsink);
DLLEXPORT operator bool() const;
DLLEXPORT QoreStringNode* getPEM(ExceptionSink* xsink) const;
DLLEXPORT BinaryNode* getDER(ExceptionSink* xsink) const;
// caller does NOT own the X509 pointer returned; "const" cannot be used because of the openssl API does not support it
DLLEXPORT X509* getData() const;
// caller owns value returned
DLLEXPORT QoreHashNode* getSubjectHash() const;
// caller owns value returned
DLLEXPORT QoreHashNode* getIssuerHash() const;
DLLEXPORT int64 getSerialNumber() const;
DLLEXPORT int64 getVersion() const;
// caller owns value returned
DLLEXPORT QoreHashNode* getPurposeHash() const;
// caller owns value returned
DLLEXPORT DateTimeNode* getNotBeforeDate() const;
// caller owns value returned
DLLEXPORT DateTimeNode* getNotAfterDate() const;
// caller owns value returned
DLLEXPORT QoreStringNode* getSignatureType() const;
// caller owns value returned
DLLEXPORT BinaryNode* getSignature() const;
// caller owns value returned
DLLEXPORT QoreStringNode* getPublicKeyAlgorithm() const;
// caller owns value returned
DLLEXPORT BinaryNode* getPublicKey() const;
// caller owns value returned
DLLEXPORT QoreHashNode* getInfo() const;
// caller owns reference returned
DLLEXPORT QoreSSLCertificate* certRefSelf() const;
protected:
DLLLOCAL virtual ~QoreSSLCertificate();
private:
struct qore_sslcert_private* priv;
DLLLOCAL QoreValue doPurposeValue(int id, int ca) const;
DLLLOCAL QoreSSLCertificate(const QoreSSLCertificate&) = delete;
DLLLOCAL QoreSSLCertificate& operator=(const QoreSSLCertificate&) = delete;
};
#endif
QoreSSLCertificate
represents an X509 certificate, reference-counted, dynamically-allocated only
Definition: QoreSSLCertificate.h:42
QoreHashNode
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
AbstractPrivateData
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:44
QoreSSLCertificate::~QoreSSLCertificate
virtual DLLLOCAL ~QoreSSLCertificate()
the destructor is protected to ensure that it&#39;s only dynamically allocated (use deref() to delete) ...
QoreString
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:81
QoreStringNode
Qore&#39;s string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
DateTimeNode
Qore&#39;s parse tree/value type for date-time values, reference-counted, dynamically-allocated only...
Definition: DateTimeNode.h:45
QoreValue
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:267
QoreSSLCertificate::getDER
DLLEXPORT BinaryNode * getDER(ExceptionSink *xsink) const
returns a binary in DER format representing the certificate, caller owns the BinaryNode reference cou...
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
int64
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
QoreSSLCertificate::getPEM
DLLEXPORT QoreStringNode * getPEM(ExceptionSink *xsink) const
returns a string in PEM format representing the certificate; caller owns the QoreStringNode reference...
QoreSSLBase
offers static functions to help with translating openssl data structures to Qore data structures ...
Definition: QoreSSLBase.h:40
QoreSSLCertificate::QoreSSLCertificate
DLLEXPORT QoreSSLCertificate(X509 *c)
creates the object from a pointer to an X509 data structure, the QoreSSLCertificate object takes owne...
BinaryNode
holds arbitrary binary data
Definition: BinaryNode.h:41