QoreSSLCertificate.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreSSLCertificate.h
Qore Programming Language
Copyright (C) 2003 - 2015 David Nichols
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 {
private:
struct qore_sslcert_private* priv;
DLLLOCAL AbstractQoreNode* doPurposeValue(int id, int ca) const;
DLLLOCAL QoreSSLCertificate(const QoreSSLCertificate&);
DLLLOCAL QoreSSLCertificate& operator=(const QoreSSLCertificate&);
protected:
DLLLOCAL virtual ~QoreSSLCertificate();
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;
// 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;
};
#endif
QoreSSLCertificate::getPEM
DLLEXPORT QoreStringNode * getPEM(ExceptionSink *xsink) const
returns a string in PEM format representing the certificate; caller owns the QoreStringNode reference...
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:49
AbstractPrivateData
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:44
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:55
QoreSSLCertificate::~QoreSSLCertificate
virtual DLLLOCAL ~QoreSSLCertificate()
the destructor is protected to ensure that it's only dynamically allocated (use deref() to delete) ...
QoreString
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:82
QoreStringNode
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
DateTimeNode
Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only...
Definition: DateTimeNode.h:44
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:43
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:228
QoreSSLBase
offers static functions to help with translating openssl data structures to Qore data structures ...
Definition: QoreSSLBase.h:40
BinaryNode
holds arbitrary binary data
Definition: BinaryNode.h:41