forked from chris2511/xca
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_obj.cpp
More file actions
188 lines (164 loc) · 3.5 KB
/
load_obj.cpp
File metadata and controls
188 lines (164 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* vi: set sw=4 ts=4:
*
* Copyright (C) 2001 - 2020 Christian Hohnstaedt.
*
* All rights reserved.
*/
#include "load_obj.h"
#include "pki_x509.h"
#include "pki_evp.h"
#include "pki_x509req.h"
#include "pki_pkcs7.h"
#include "pki_pkcs12.h"
#include "pki_multi.h"
#include "pki_temp.h"
#include "pki_crl.h"
load_base::load_base()
{
filter = QObject::tr("All files ( * )");
caption = "";
}
pki_base *load_base::loadItem(const QString &s)
{
pki_base *pki = newItem();
if (!pki)
return NULL;
try {
pki->fload(s);
openssl_error();
}
catch (errorEx &err){
delete pki;
throw err;
}
pki->pkiSource = imported;
pki->autoIntName(s);
pki->setFilename(s);
return pki;
}
pki_base * load_base::newItem()
{
return NULL;
}
load_base::~load_base()
{
}
/* Keys */
load_key::load_key()
:load_base()
{
filter = QObject::tr("PKI Keys ( *.pem *.der *.key );; "
"PKCS#8 Keys ( *.p8 *.pk8 );; "
"Microsoft PVK Keys ( *.pvk );; "
"SSH Public Keys ( *.pub );;") + filter;
caption = QObject::tr("Import RSA key");
}
pki_base * load_key::newItem()
{
return new pki_evp();
}
/* Requests */
load_req::load_req()
:load_base()
{
filter = QObject::tr("PKCS#10 CSR ( *.pem *.der *.csr );; ") + filter;
caption = QObject::tr("Import Request");
}
pki_base * load_req::newItem()
{
return new pki_x509req();
}
/* Certificates */
load_cert::load_cert()
:load_base()
{
filter = QObject::tr("Certificates ( *.pem *.der *.crt *.cer );;") + filter;
caption = QObject::tr("Import X.509 Certificate");
}
pki_base * load_cert::newItem()
{
return new pki_x509();
}
/* PKCS#7 Certificates */
load_pkcs7::load_pkcs7()
:load_base()
{
filter = QObject::tr("PKCS#7 data ( *.p7s *.p7m *.p7b );;") + filter;
caption = QObject::tr("Import PKCS#7 Certificates");
}
pki_base * load_pkcs7::newItem()
{
return new pki_pkcs7();
}
/* PKCS#12 Certificates */
load_pkcs12::load_pkcs12()
:load_base()
{
filter = QObject::tr("PKCS#12 Certificates ( *.p12 *.pfx );;") + filter;
caption = QObject::tr("Import PKCS#12 Private Certificate");
}
pki_base * load_pkcs12::loadItem(const QString &s)
{
pki_base *p12 = new pki_pkcs12(s);
return p12;
}
/* Templates */
load_temp::load_temp()
:load_base()
{
filter = QObject::tr("XCA templates ( *.xca );;") + filter;
caption = QObject::tr("Import XCA Templates");
}
pki_base * load_temp::newItem()
{
return new pki_temp();
}
/* CRLs */
load_crl::load_crl()
:load_base()
{
filter = QObject::tr("Revocation lists ( *.pem *.der *.crl );;") + filter;
caption = QObject::tr("Import Certificate Revocation List");
}
pki_base * load_crl::newItem()
{
return new pki_crl();
}
/* Database */
load_db::load_db()
:load_base()
{
filter = QObject::tr("XCA Databases ( *.xdb );;") + filter;
caption = QObject::tr("Open XCA Database");
}
/* OpenVPN TA key */
load_takey::load_takey()
:load_base()
{
filter = QObject::tr("OpenVPN tls-auth key ( *.key );;") + filter;
caption = QObject::tr("Import OpenVPN tls-auth key");
}
/* Shared library */
load_pkcs11::load_pkcs11()
:load_base()
{
#if defined(Q_OS_WIN32)
filter = QObject::tr("PKCS#11 library ( *.dll );;") + filter;
#elif defined(Q_OS_MACOS)
filter = QObject::tr("PKCS#11 library ( *.dylib *.so );;") + filter;
#else
filter = QObject::tr("PKCS#11 library ( *.so );;") + filter;
#endif
caption = QObject::tr("Open PKCS#11 shared library");
}
/* General PEM loader */
load_pem::load_pem()
:load_base()
{
filter = QObject::tr("PEM files ( *.pem );;") + filter;
caption = QObject::tr("Load PEM encoded file");
}
pki_base *load_pem::newItem()
{
return new pki_multi();
}