comparison ui/certificate.cpp @ 204:825b42da1855

Avoid printing an error when an empty certificate ist constructed
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 26 Mar 2014 13:32:47 +0100
parents 2551ad24d3c2
children 64e38886f903
comparison
equal deleted inserted replaced
203:60c5df8e7980 204:825b42da1855
13 int ret = -1; 13 int ret = -1;
14 char buf[POLARSSL_INFO_BUF_SIZE]; 14 char buf[POLARSSL_INFO_BUF_SIZE];
15 15
16 x509_crt x509cert; 16 x509_crt x509cert;
17 17
18 if (b64Line.isEmpty()) {
19 return;
20 }
21
18 /* Cut of the first two chars (e.g. I: and decode) */ 22 /* Cut of the first two chars (e.g. I: and decode) */
19 QByteArray asn1data = QByteArray::fromBase64( 23 QByteArray asn1data = QByteArray::fromBase64(
20 b64Line.right(b64Line.size() - 2).toLatin1()); 24 b64Line.right(b64Line.size() - 2).toLatin1());
21 25
22 x509_crt_init(&x509cert); 26 x509_crt_init(&x509cert);
23 ret = x509_crt_parse(&x509cert, 27 ret = x509_crt_parse(&x509cert,
24 (const unsigned char*) asn1data.constData(), 28 (const unsigned char*) asn1data.constData(),
25 asn1data.size()); 29 asn1data.size());
26 if (ret != 0) { 30 if (ret != 0) {
27 qDebug() << "Parsing certificate failed with error: " << ret; 31 qDebug() << "Parsing certificate failed with error: " << ret;
32 qDebug() << "Failed cert: " << asn1data.toBase64();
28 x509_crt_free(&x509cert); 33 x509_crt_free(&x509cert);
29 return; 34 return;
30 } 35 }
31 36
32 /* Get a full details string */ 37 /* Get a full details string */

http://wald.intevation.org/projects/trustbridge/