tests/auto/qsslcertificate/tst_qsslcertificate.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   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     void largeSerialNumber();
       
   113     void largeExpirationDate();
   113 // ### add tests for certificate bundles (multiple certificates concatenated into a single
   114 // ### add tests for certificate bundles (multiple certificates concatenated into a single
   114 //     structure); both PEM and DER formatted
   115 //     structure); both PEM and DER formatted
   115 #endif
   116 #endif
   116 };
   117 };
   117 
   118 
   800     const QSslCertificate &cert = certList.at(0);
   801     const QSslCertificate &cert = certList.at(0);
   801     QVERIFY(!cert.isNull());
   802     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     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 }
   804 
   805 
       
   806 void tst_QSslCertificate::largeExpirationDate() // QTBUG-12489
       
   807 {
       
   808     QList<QSslCertificate> certList =
       
   809         QSslCertificate::fromPath(SRCDIR "more-certificates/cert-large-expiration-date.pem");
       
   810 
       
   811     QCOMPARE(certList.size(), 1);
       
   812 
       
   813     const QSslCertificate &cert = certList.at(0);
       
   814     QVERIFY(!cert.isNull());
       
   815     QCOMPARE(cert.effectiveDate().toUTC(), QDateTime(QDate(2010, 8, 4), QTime(9, 53, 41), Qt::UTC));
       
   816     // if the date is larger than 2049, then the generalized time format is used
       
   817     QCOMPARE(cert.expiryDate().toUTC(), QDateTime(QDate(2051, 8, 29), QTime(9, 53, 41), Qt::UTC));
       
   818 }
       
   819 
   805 #endif // QT_NO_OPENSSL
   820 #endif // QT_NO_OPENSSL
   806 
   821 
   807 QTEST_MAIN(tst_QSslCertificate)
   822 QTEST_MAIN(tst_QSslCertificate)
   808 #include "tst_qsslcertificate.moc"
   823 #include "tst_qsslcertificate.moc"