1 //******************************************************************************
2 //  Copyright (c) 2005-2013 by Jan Van hijfte
3 //
4 //  See the included file COPYING.TXT for details about the copyright.
5 //
6 //  This program is distributed in the hope that it will be useful,
7 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 //******************************************************************************
10 
11 
12 #include "qsslkey_c.h"
13 
QSslKey_Create()14 QSslKeyH QSslKey_Create()
15 {
16 	return (QSslKeyH) new QSslKey();
17 }
18 
QSslKey_Destroy(QSslKeyH handle)19 void QSslKey_Destroy(QSslKeyH handle)
20 {
21 	delete (QSslKey *)handle;
22 }
23 
QSslKey_Create2(const QByteArrayH encoded,QSsl::KeyAlgorithm algorithm,QSsl::EncodingFormat format,QSsl::KeyType type,const QByteArrayH passPhrase)24 QSslKeyH QSslKey_Create2(const QByteArrayH encoded, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat format, QSsl::KeyType type, const QByteArrayH passPhrase)
25 {
26 	return (QSslKeyH) new QSslKey(*(const QByteArray*)encoded, algorithm, format, type, *(const QByteArray*)passPhrase);
27 }
28 
QSslKey_Create3(QIODeviceH device,QSsl::KeyAlgorithm algorithm,QSsl::EncodingFormat format,QSsl::KeyType type,const QByteArrayH passPhrase)29 QSslKeyH QSslKey_Create3(QIODeviceH device, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat format, QSsl::KeyType type, const QByteArrayH passPhrase)
30 {
31 	return (QSslKeyH) new QSslKey((QIODevice*)device, algorithm, format, type, *(const QByteArray*)passPhrase);
32 }
33 
QSslKey_Create4(Qt::HANDLE handle,QSsl::KeyType type)34 QSslKeyH QSslKey_Create4(Qt::HANDLE handle, QSsl::KeyType type)
35 {
36 	return (QSslKeyH) new QSslKey(handle, type);
37 }
38 
QSslKey_Create5(const QSslKeyH other)39 QSslKeyH QSslKey_Create5(const QSslKeyH other)
40 {
41 	return (QSslKeyH) new QSslKey(*(const QSslKey*)other);
42 }
43 
QSslKey_swap(QSslKeyH handle,QSslKeyH other)44 void QSslKey_swap(QSslKeyH handle, QSslKeyH other)
45 {
46 	((QSslKey *)handle)->swap(*(QSslKey*)other);
47 }
48 
QSslKey_isNull(QSslKeyH handle)49 bool QSslKey_isNull(QSslKeyH handle)
50 {
51 	return (bool) ((QSslKey *)handle)->isNull();
52 }
53 
QSslKey_clear(QSslKeyH handle)54 void QSslKey_clear(QSslKeyH handle)
55 {
56 	((QSslKey *)handle)->clear();
57 }
58 
QSslKey_length(QSslKeyH handle)59 int QSslKey_length(QSslKeyH handle)
60 {
61 	return (int) ((QSslKey *)handle)->length();
62 }
63 
QSslKey_type(QSslKeyH handle)64 QSsl::KeyType QSslKey_type(QSslKeyH handle)
65 {
66 	return (QSsl::KeyType) ((QSslKey *)handle)->type();
67 }
68 
QSslKey_algorithm(QSslKeyH handle)69 QSsl::KeyAlgorithm QSslKey_algorithm(QSslKeyH handle)
70 {
71 	return (QSsl::KeyAlgorithm) ((QSslKey *)handle)->algorithm();
72 }
73 
QSslKey_toPem(QSslKeyH handle,QByteArrayH retval,const QByteArrayH passPhrase)74 void QSslKey_toPem(QSslKeyH handle, QByteArrayH retval, const QByteArrayH passPhrase)
75 {
76 	*(QByteArray *)retval = ((QSslKey *)handle)->toPem(*(const QByteArray*)passPhrase);
77 }
78 
QSslKey_toDer(QSslKeyH handle,QByteArrayH retval,const QByteArrayH passPhrase)79 void QSslKey_toDer(QSslKeyH handle, QByteArrayH retval, const QByteArrayH passPhrase)
80 {
81 	*(QByteArray *)retval = ((QSslKey *)handle)->toDer(*(const QByteArray*)passPhrase);
82 }
83 
QSslKey_handle(QSslKeyH handle)84 Qt::HANDLE QSslKey_handle(QSslKeyH handle)
85 {
86 	return (Qt::HANDLE) ((QSslKey *)handle)->handle();
87 }
88 
89