equal
deleted
inserted
replaced
107 void certInfo(); |
107 void certInfo(); |
108 void certInfoQByteArray(); |
108 void certInfoQByteArray(); |
109 void task256066toPem(); |
109 void task256066toPem(); |
110 void nulInCN(); |
110 void nulInCN(); |
111 void nulInSan(); |
111 void nulInSan(); |
|
112 void largeSerialNumber(); |
112 // ### add tests for certificate bundles (multiple certificates concatenated into a single |
113 // ### add tests for certificate bundles (multiple certificates concatenated into a single |
113 // structure); both PEM and DER formatted |
114 // structure); both PEM and DER formatted |
114 #endif |
115 #endif |
115 }; |
116 }; |
116 |
117 |
539 QTest::newRow("\"d.*/c.*.pem\" fixed der") << QString("d.*/c.*.pem") << int(QRegExp::FixedString) << false << 0; |
540 QTest::newRow("\"d.*/c.*.pem\" fixed der") << QString("d.*/c.*.pem") << int(QRegExp::FixedString) << false << 0; |
540 QTest::newRow("\"d.*/c.*.pem\" regexp pem") << QString("d.*/c.*.pem") << int(QRegExp::RegExp) << true << 0; |
541 QTest::newRow("\"d.*/c.*.pem\" regexp pem") << QString("d.*/c.*.pem") << int(QRegExp::RegExp) << true << 0; |
541 QTest::newRow("\"d.*/c.*.pem\" regexp der") << QString("d.*/c.*.pem") << int(QRegExp::RegExp) << false << 0; |
542 QTest::newRow("\"d.*/c.*.pem\" regexp der") << QString("d.*/c.*.pem") << int(QRegExp::RegExp) << false << 0; |
542 QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0; |
543 QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0; |
543 QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0; |
544 QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0; |
|
545 #ifdef Q_OS_LINUX |
|
546 QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 4; |
|
547 #endif |
544 |
548 |
545 QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1; |
549 QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1; |
546 QTest::newRow("no-ending-newline") << QString("more-certificates/no-ending-newline.pem") << int(QRegExp::FixedString) << true << 1; |
550 QTest::newRow("no-ending-newline") << QString("more-certificates/no-ending-newline.pem") << int(QRegExp::FixedString) << true << 1; |
547 QTest::newRow("malformed-just-begin") << QString("more-certificates/malformed-just-begin.pem") << int(QRegExp::FixedString) << true << 0; |
551 QTest::newRow("malformed-just-begin") << QString("more-certificates/malformed-just-begin.pem") << int(QRegExp::FixedString) << true << 0; |
548 QTest::newRow("malformed-just-begin-no-newline") << QString("more-certificates/malformed-just-begin-no-newline.pem") << int(QRegExp::FixedString) << true << 0; |
552 QTest::newRow("malformed-just-begin-no-newline") << QString("more-certificates/malformed-just-begin-no-newline.pem") << int(QRegExp::FixedString) << true << 0; |
784 |
788 |
785 static const char realSAN[] = "www.bank.com\0www.badguy.com"; |
789 static const char realSAN[] = "www.bank.com\0www.badguy.com"; |
786 QCOMPARE(dnssan, QString::fromLatin1(realSAN, sizeof realSAN - 1)); |
790 QCOMPARE(dnssan, QString::fromLatin1(realSAN, sizeof realSAN - 1)); |
787 } |
791 } |
788 |
792 |
|
793 void tst_QSslCertificate::largeSerialNumber() |
|
794 { |
|
795 QList<QSslCertificate> certList = |
|
796 QSslCertificate::fromPath(SRCDIR "more-certificates/cert-large-serial-number.pem"); |
|
797 |
|
798 QCOMPARE(certList.size(), 1); |
|
799 |
|
800 const QSslCertificate &cert = certList.at(0); |
|
801 QVERIFY(!cert.isNull()); |
|
802 QCOMPARE(cert.serialNumber(), QByteArray("01:02:03:04:05:06:07:08:09:10:aa:bb:cc:dd:ee:ff:17:18:19:20")); |
|
803 } |
|
804 |
789 #endif // QT_NO_OPENSSL |
805 #endif // QT_NO_OPENSSL |
790 |
806 |
791 QTEST_MAIN(tst_QSslCertificate) |
807 QTEST_MAIN(tst_QSslCertificate) |
792 #include "tst_qsslcertificate.moc" |
808 #include "tst_qsslcertificate.moc" |