From 7f374e0d94230c6742b9ef8bf422f7849e0fc013 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 15 Jun 2009 17:08:34 +0200 Subject: Fix wrong comparator in QSslCertificatePrivate::QByteArray_from_X509 Because less-than instead of less-or-equal-than was used, the last line of a PEM encoding was not built when the raw length was multiple of 64. Task-number: 256066 Reviewed-by: mariusSO --- src/network/ssl/qsslcertificate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/network/ssl/qsslcertificate.cpp') diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index ccb3f06d5b..21d5a33345 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -610,7 +610,7 @@ QByteArray QSslCertificatePrivate::QByteArray_from_X509(X509 *x509, QSsl::Encodi // Convert to Base64 - wrap at 64 characters. array = array.toBase64(); QByteArray tmp; - for (int i = 0; i < array.size() - 64; i += 64) { + for (int i = 0; i <= array.size() - 64; i += 64) { tmp += QByteArray::fromRawData(array.data() + i, 64); tmp += "\n"; } -- cgit v1.2.1 From 858c70f768eeb2d65cefd4115f4e9089b588b2d0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 16 Jun 2009 22:08:09 +1000 Subject: Update license headers as requested by the marketing department. Reviewed-by: Trust Me --- src/network/ssl/qsslcertificate.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/network/ssl/qsslcertificate.cpp') diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 21d5a33345..7a4b7646ce 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -34,7 +34,7 @@ ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. +** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v1.2.1 From 237a3e690f290fd8ef8ef2a51459caa7fdc7bef1 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 16 Jun 2009 13:09:25 +0200 Subject: QSslCertificate: lazy loading of some data Reviewed-by: Andreas Aardal Hanssen --- src/network/ssl/qsslcertificate.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/network/ssl/qsslcertificate.cpp') diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 1403b26702..ef48cf2861 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -125,6 +125,9 @@ QT_BEGIN_NAMESPACE +// forward declaration +static QMap _q_mapFromOnelineName(char *name); + /*! Constructs a QSslCertificate by reading \a format encoded data from \a device and using the first certificate found. You can @@ -300,6 +303,10 @@ static QString _q_SubjectInfoToString(QSslCertificate::SubjectInfo info) */ QString QSslCertificate::issuerInfo(SubjectInfo info) const { + if (d->issuerInfo.isEmpty() && d->x509) + d->issuerInfo = + _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); + return d->issuerInfo.value(_q_SubjectInfoToString(info)); } @@ -327,6 +334,10 @@ QString QSslCertificate::issuerInfo(const QByteArray &tag) const */ QString QSslCertificate::subjectInfo(SubjectInfo info) const { + if (d->subjectInfo.isEmpty() && d->x509) + d->subjectInfo = + _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); + return d->subjectInfo.value(_q_SubjectInfoToString(info)); } @@ -662,11 +673,6 @@ QSslCertificate QSslCertificatePrivate::QSslCertificate_from_X509(X509 *x509) if (!x509 || !QSslSocket::supportsSsl()) return certificate; - certificate.d->issuerInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(x509), 0, 0)); - certificate.d->subjectInfo = - _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(x509), 0, 0)); - ASN1_TIME *nbef = q_X509_get_notBefore(x509); ASN1_TIME *naft = q_X509_get_notAfter(x509); certificate.d->notValidBefore = q_getTimeFromASN1(nbef); -- cgit v1.2.1