~ubuntu-branches/ubuntu/oneiric/xca/oneiric

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
/* vi: set sw=4 ts=4:
 *
 * Copyright (C) 2001 - 2007 Christian Hohnstaedt.
 *
 * All rights reserved.
 */

#include "load_obj.h"
#include "pki_x509.h"
#include "pki_key.h"
#include "pki_x509req.h"
#include "pki_pkcs7.h"
#include "pki_pkcs12.h"
#include "pki_multi.h"
#include "widgets/MainWindow.h"

load_base::load_base()
{
	filter = QObject::tr("All files ( * )");
	caption = "";
}

pki_base *load_base::loadItem(QString s)
{
	pki_base *pki = newItem();
	if (!pki)
		return NULL;
	try {
		pki->fload(s);
	}
	catch (errorEx &err){
		delete pki;
		throw err;
	}
	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 );;") + filter;
	caption = QObject::tr("Import RSA key");
}

pki_base * load_key::newItem()
{
	return new pki_key();
}

/* Requests */
load_req::load_req()
	:load_base()
{
	filter = QObject::tr("PKCS#10 CSR ( *.pem *.der *.csr );;"
			"Netscape Request ( *.spkac *.spc );;") + 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(QString s)
{
	pki_base *p12 = new pki_pkcs12(s, MainWindow::passRead);
	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");
}

/* 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();
}