diff options
author | Richard Moore <rich@kde.org> | 2011-07-11 16:15:14 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-11 17:33:16 +0200 |
commit | 852d4b03f612748fb16f592dda884e9634b468cf (patch) | |
tree | 63fec458c411f8cf727a04efdc98491f4b48f3a0 /tests/auto/qsslcertificate/tst_qsslcertificate.cpp | |
parent | 14b56b2be40fc6290e096116edad979982eb83dd (diff) |
SSL: Add methods to access the tags of the subject and issuer of a cert
Add methods that return a list of the tags in use in a certificate
issuer or subject. This means that unknown elements of these fields can
be accessed.
Change-Id: I588989e34f541b1d31cc9e97f5a85d1624ece1b1
Merge-request: 18
Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Reviewed-on: http://codereview.qt.nokia.com/1451
Diffstat (limited to 'tests/auto/qsslcertificate/tst_qsslcertificate.cpp')
-rw-r--r-- | tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index e95af1e97c..c04f315060 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -115,6 +115,7 @@ private slots: void blacklistedCertificates(); void toText(); void multipleCommonNames(); + void subjectAndIssuerTags(); // ### add tests for certificate bundles (multiple certificates concatenated into a single // structure); both PEM and DER formatted @@ -883,6 +884,23 @@ void tst_QSslCertificate::multipleCommonNames() QVERIFY(commonNames.contains(QString("www2.example.com"))); } +void tst_QSslCertificate::subjectAndIssuerTags() +{ + QList<QSslCertificate> certList = + QSslCertificate::fromPath(SRCDIR "more-certificates/test-cn-with-drink-cert.pem"); + QVERIFY2(certList.count() > 0, "Please run this test from the source directory"); + + QList<QByteArray> tags = certList[0].subjectInfoTags(); + QVERIFY(tags.contains(QByteArray("favouriteDrink"))); + tags.clear(); + + certList = QSslCertificate::fromPath(SRCDIR "more-certificates/natwest-banking.pem"); + QVERIFY2(certList.count() > 0, "Please run this test from the source directory"); + + tags = certList[0].subjectInfoTags(); + QVERIFY(tags.contains(QByteArray("1.3.6.1.4.1.311.60.2.1.3"))); +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslCertificate) |