| Qore Programming Language - C/C++ Library 1.0.8

QoreSSLPrivateKey.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3 QC_SSLPrivateKey.h
4
5 Qore Programming Language
6
7 Copyright (C) 2003 - 2018 Qore Technologies, s.r.o.
8
9 Permission is hereby granted, free of charge, to any person obtaining a
10 copy of this software and associated documentation files (the "Software"),
11 to deal in the Software without restriction, including without limitation
12 the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so, subject to the following conditions:
15
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26
27 Note that the Qore library is released under a choice of three open-source
28 licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29 information.
30 */
31
32 #ifndef _QORE_QORESSLPRIVATEKEY_H
33
34 #define _QORE_QORESSLPRIVATEKEY_H
35
36 #include <openssl/ssl.h>
37 #include <openssl/evp.h>
38
40 class QoreSSLPrivateKey : public AbstractPrivateData {
41 public:
43
47 DLLEXPORT QoreSSLPrivateKey(const char* fn, const char* pp, ExceptionSink* xsink);
48
50
53 DLLEXPORT QoreSSLPrivateKey(const BinaryNode* bin, ExceptionSink* xsink);
54
56
60 DLLEXPORT QoreSSLPrivateKey(const QoreString* str, const char* pp, ExceptionSink* xsink);
61
63
65 DLLEXPORT QoreStringNode* getPEM(ExceptionSink* xsink) const;
66
68
72 DLLEXPORT BinaryNode* getDER(ExceptionSink* xsink) const;
73
74 // caller does NOT own the EVP_PKEY returned; "const" cannot be used because the openssl API does not support it
75 DLLEXPORT EVP_PKEY* getData() const;
76
78 DLLEXPORT const char* getType() const;
79
81 DLLEXPORT int64 getVersion() const;
82
84 DLLEXPORT int64 getBitLength() const;
85
87 DLLEXPORT QoreHashNode* getInfo() const;
88
90 DLLEXPORT QoreSSLPrivateKey* pkRefSelf() const;
91
93 DLLLOCAL QoreSSLPrivateKey(EVP_PKEY* p);
94
95 protected:
96 DLLLOCAL virtual ~QoreSSLPrivateKey();
97
98 private:
99 // the private implementation of the class
100 struct qore_sslpk_private *priv;
101
103 DLLLOCAL QoreSSLPrivateKey(const QoreSSLPrivateKey&) = delete;
104
106 DLLLOCAL QoreSSLPrivateKey& operator=(const QoreSSLPrivateKey&) = delete;
107 };
108
109 #endif
QoreSSLPrivateKey::QoreSSLPrivateKey
DLLEXPORT QoreSSLPrivateKey(const char *fn, const char *pp, ExceptionSink *xsink)
creates the object from a file name by reading in the file in PEM format
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
QoreSSLPrivateKey::getDER
DLLEXPORT BinaryNode * getDER(ExceptionSink *xsink) const
returns a binary in DER format representing the private key, caller owns the BinaryNode reference cou...
QoreSSLPrivateKey
provides access to a private key data structure for SSL connections
Definition: QoreSSLPrivateKey.h:40
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
QoreSSLPrivateKey::getInfo
DLLEXPORT QoreHashNode * getInfo() const
caller owns the QoreHashNode reference count returned
QoreSSLPrivateKey::getVersion
DLLEXPORT int64 getVersion() const
returns a constant &#39;1&#39;: do not use; only included for backwards-compatibility
QoreSSLPrivateKey::getBitLength
DLLEXPORT int64 getBitLength() const
returns the length in bits
QoreSSLPrivateKey::getType
DLLEXPORT const char * getType() const
returns the key type
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
QoreSSLPrivateKey::pkRefSelf
DLLEXPORT QoreSSLPrivateKey * pkRefSelf() const
caller owns reference returned
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
QoreSSLPrivateKey::getPEM
DLLEXPORT QoreStringNode * getPEM(ExceptionSink *xsink) const
returns a string in PEM format representing the private key, caller owns the QoreStringNode reference...
BinaryNode
holds arbitrary binary data
Definition: BinaryNode.h:41