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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
/*
* "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
* (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
* aplicativos mainframe. Registro no INPI sob o nome G3270.
*
* Copyright (C) <2008> <Banco do Brasil S.A.>
*
* Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
* os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
* Free Software Foundation.
*
* Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
* GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
* A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
* obter mais detalhes.
*
* Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
* programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
* St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Este programa está nomeado como - e possui - linhas de código.
*
* Contatos:
*
* perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
* erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
*
*/
/// @brief OpenSSL states.
#include "private.h"
/*--[ Implement ]------------------------------------------------------------------------------------*/
const LIB3270_SSL_MESSAGE * lib3270_openssl_message_from_id(long id) {
static const struct {
long id;
LIB3270_SSL_MESSAGE message;
} messages[] = {
// http://www.openssl.org/docs/apps/verify.html
{
.id = X509_V_OK,
.message = {
.name = "X509_V_OK",
.type = LIB3270_NOTIFY_INFO,
.icon = "security-high",
.summary = N_( "Secure connection was successful." ),
.body = N_( "The connection is secure and the host identity was confirmed." )
}
},
{
.id = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT,
.message = {
.name = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Unable to get issuer certificate" ),
.body = N_( "The issuer certificate of a looked up certificate could not be found. This normally means the list of trusted certificates is not complete." )
}
},
{
.id = X509_V_ERR_UNABLE_TO_GET_CRL,
.message = {
.name = "X509_V_ERR_UNABLE_TO_GET_CRL",
#ifdef SSL_ENABLE_CRL_CHECK
.type = LIB3270_NOTIFY_SECURE,
#else
.type = LIB3270_NOTIFY_INFO,
#endif // SSL_ENABLE_CRL_CHECK
.icon = "security-low",
.summary = N_( "Unable to get certificate CRL." ),
.body = N_( "The Certificate revocation list (CRL) of a certificate could not be found." ),
.label = N_( "Continue" )
}
},
{
.id = X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE,
.message = {
.name = "X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Unable to decrypt certificate's signature" ),
.body = N_( "The certificate signature could not be decrypted. This means that the actual signature value could not be determined rather than it not matching the expected value, this is only meaningful for RSA keys." )
}
},
{
.id = X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE,
.message = {
.name = "X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Unable to decrypt CRL's signature" ),
.body = N_( "The CRL signature could not be decrypted: this means that the actual signature value could not be determined rather than it not matching the expected value. Unused." )
}
},
{
.id = X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY,
.message = {
.name = "X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Unable to decode issuer public key" ),
.body = N_( "The public key in the certificate SubjectPublicKeyInfo could not be read." )
}
},
{
.id = X509_V_ERR_CERT_SIGNATURE_FAILURE,
.message = {
.name = "X509_V_ERR_CERT_SIGNATURE_FAILURE",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Certificate signature failure" ),
.body = N_( "The signature of the certificate is invalid." )
}
},
{
.id = X509_V_ERR_CRL_SIGNATURE_FAILURE,
.message = {
.name = "X509_V_ERR_CRL_SIGNATURE_FAILURE",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "CRL signature failure" ),
.body = N_( "The signature of the certificate is invalid." )
}
},
{
.id = X509_V_ERR_CERT_NOT_YET_VALID,
.message = {
.name = "X509_V_ERR_CERT_NOT_YET_VALID",
.type = LIB3270_NOTIFY_WARNING,
.icon = "security-medium",
.summary = N_( "Certificate is not yet valid" ),
.body = N_( "The certificate is not yet valid: the notBefore date is after the current time." )
}
},
{
.id = X509_V_ERR_CERT_HAS_EXPIRED,
.message = {
.name = "X509_V_ERR_CERT_HAS_EXPIRED",
.type = LIB3270_NOTIFY_SECURE,
.icon = "security-medium",
.summary = N_( "Certificate has expired" ),
.body = N_( "The certificate has expired: that is the notAfter date is before the current time." )
}
},
{
.id = X509_V_ERR_CRL_NOT_YET_VALID,
.message = {
.name = "X509_V_ERR_CRL_NOT_YET_VALID",
.type = LIB3270_NOTIFY_WARNING,
.icon = "security-medium",
.summary = N_( "The CRL is not yet valid." ),
.body = N_( "The Certificate revocation list (CRL) is not yet valid." )
}
},
{
.id = X509_V_ERR_CRL_HAS_EXPIRED,
.message = {
.name = "X509_V_ERR_CRL_HAS_EXPIRED",
#ifdef SSL_ENABLE_CRL_EXPIRATION_CHECK
.type = LIB3270_NOTIFY_SECURE,
#else
.type = LIB3270_NOTIFY_INFO,
#endif // SSL_ENABLE_CRL_EXPIRATION_CHECK
.icon = "security-medium",
.summary = N_( "The CRL has expired." ),
.body = N_( "The Certificate revocation list (CRL) has expired.")
}
},
{
.id = X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD,
.message = {
.name = "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Format error in certificate's notBefore field" ),
.body = N_( "The certificate notBefore field contains an invalid time." )
}
},
{
.id = X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD,
.message = {
.name = "X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Format error in certificate's notAfter field" ),
.body = N_( "The certificate notAfter field contains an invalid time." )
}
},
{
.id = X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD,
.message = {
.name = "X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Format error in CRL's lastUpdate field" ),
.body = N_( "The CRL lastUpdate field contains an invalid time." )
}
},
{
.id = X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD,
.message = {
.name = "X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Format error in CRL's nextUpdate field" ),
.body = N_( "The CRL nextUpdate field contains an invalid time." )
}
},
{
.id = X509_V_ERR_OUT_OF_MEM,
.message = {
.name = "X509_V_ERR_OUT_OF_MEM",
.type = LIB3270_NOTIFY_ERROR,
.icon = "dialog-error",
.summary = N_( "Out of memory" ),
.body = N_( "An error occurred trying to allocate memory. This should never happen." )
}
},
{
.id = X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT,
.message = {
.name = "X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT",
#ifdef SSL_ENABLE_SELF_SIGNED_CERT_CHECK
.type = LIB3270_NOTIFY_WARNING,
#else
.type = LIB3270_NOTIFY_SECURE,
#endif // SSL_ENABLE_SELF_SIGNED_CERT_CHECK
.icon = "security-medium",
.summary = N_( "Self signed certificate" ),
.label = N_( "Continue" ),
.body = N_( "The passed certificate is self signed and the same certificate cannot be found in the list of trusted certificates." )
}
},
{
.id = X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN,
.message = {
.name = "X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN",
#ifdef SSL_ENABLE_SELF_SIGNED_CERT_CHECK
.type = LIB3270_NOTIFY_INFO,
#else
.type = LIB3270_NOTIFY_SECURE,
#endif // SSL_ENABLE_SELF_SIGNED_CERT_CHECK
.icon = "security-low",
.label = N_("Continue"),
.summary = N_( "Self signed certificate in certificate chain" ),
.body = N_( "The certificate chain could be built up using the untrusted certificates but the root could not be found locally." )
}
},
{
.id = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY,
.message = {
.name = "X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
.type = LIB3270_NOTIFY_WARNING,
.icon = "security-low",
.summary = N_( "Unable to get local issuer certificate" ),
.body = N_( "The issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found." )
}
},
{
.id = X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE,
.message = {
.name = "X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE",
.type = LIB3270_NOTIFY_SECURE,
.icon = "security-low",
.summary = N_( "Unable to verify the first certificate" ),
.body = N_( "No signatures could be verified because the chain contains only one certificate and it is not self signed." )
}
},
{
.id = X509_V_ERR_CERT_REVOKED,
.message = {
.name = "X509_V_ERR_CERT_REVOKED",
.type = LIB3270_NOTIFY_SECURE,
.icon = "security-low",
.summary = N_( "Certificate revoked" ),
.body = N_( "The certificate has been revoked." )
}
},
{
.id = X509_V_ERR_INVALID_CA,
.message = {
.name = "X509_V_ERR_INVALID_CA",
.type = LIB3270_NOTIFY_SECURE,
.icon = "security-low",
.summary = N_( "Invalid CA certificate" ),
.body = N_( "A CA certificate is invalid. Either it is not a CA or its extensions are not consistent with the supplied purpose." )
}
},
{
.id = X509_V_ERR_PATH_LENGTH_EXCEEDED,
.message = {
.name = "X509_V_ERR_PATH_LENGTH_EXCEEDED",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Path length constraint exceeded" ),
.body = N_( "The basicConstraints pathlength parameter has been exceeded." ),
}
},
{
.id = X509_V_ERR_INVALID_PURPOSE,
.message = {
.name = "X509_V_ERR_INVALID_PURPOSE",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Unsupported certificate purpose" ),
.body = N_( "The supplied certificate cannot be used for the specified purpose." )
}
},
{
.id = X509_V_ERR_CERT_UNTRUSTED,
.message = {
.name = "X509_V_ERR_CERT_UNTRUSTED",
.type = LIB3270_NOTIFY_WARNING,
.icon = "security-low",
.summary = N_( "Certificate not trusted" ),
.body = N_( "The root CA is not marked as trusted for the specified purpose." )
}
},
{
.id = X509_V_ERR_CERT_REJECTED,
.message = {
.name = "X509_V_ERR_CERT_REJECTED",
.type = LIB3270_NOTIFY_SECURE,
.icon = "security-low",
.summary = N_( "Certificate rejected" ),
.body = N_( "The root CA is marked to reject the specified purpose." )
}
},
{
.id = X509_V_ERR_SUBJECT_ISSUER_MISMATCH,
.message = {
.name = "X509_V_ERR_SUBJECT_ISSUER_MISMATCH",
.type = LIB3270_NOTIFY_SECURE,
.icon = "security-low",
.summary = N_( "Subject issuer mismatch" ),
.body = N_( "The current candidate issuer certificate was rejected because its subject name did not match the issuer name of the current certificate. Only displayed when the -issuer_checks option is set." )
}
},
{
.id = X509_V_ERR_AKID_SKID_MISMATCH,
.message = {
.name = "X509_V_ERR_AKID_SKID_MISMATCH",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Authority and subject key identifier mismatch" ),
.body = N_( "The current candidate issuer certificate was rejected because its subject key identifier was present and did not match the authority key identifier current certificate. Only displayed when the -issuer_checks option is set." )
}
},
{
.id = X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH,
.message = {
.name = "X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Authority and issuer serial number mismatch" ),
.body = N_( "The current candidate issuer certificate was rejected because its issuer name and serial number was present and did not match the authority key identifier of the current certificate. Only displayed when the -issuer_checks option is set." )
}
},
{
.id = X509_V_ERR_KEYUSAGE_NO_CERTSIGN,
.message = {
.name = "X509_V_ERR_KEYUSAGE_NO_CERTSIGN",
.type = LIB3270_NOTIFY_SECURE,
.icon = "dialog-error",
.summary = N_( "Key usage does not include certificate signing" ),
.body = N_( "The current candidate issuer certificate was rejected because its keyUsage extension does not permit certificate signing." )
}
}
};
size_t ix;
for(ix = 0; ix < (sizeof(messages)/sizeof(messages[0])); ix++) {
if(messages[ix].id == id)
return &messages[ix].message;
}
return NULL;
}