summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-03-24 01:14:52 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2020-05-22 15:40:22 +0200
commited2c3f67565d1cf2c8b989d763449c1cf8f8899a (patch)
tree108771acca1578d2d9928236be7dd76fae066d53 /tests
parent7a1650e34331f87bab5a9372087d2a1135f9f63a (diff)
QSslCertificate: overhaul ASN.1 datetime parsing
Instead of manual string splitting (EW!), use QDateTime parsing. Moreover, X.509 certificates *must* have a valid start/end date. In case of parsing failure, reject the certificate. An autotest for this last case is coming in a separate patch. Change-Id: I934bf9e6a4a92e4befdb3b0f9450f76f67bad067 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp b/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp
index 0928ecc5a1..eb11384101 100644
--- a/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp
+++ b/tests/auto/network/ssl/qasn1element/tst_qasn1element.cpp
@@ -170,6 +170,12 @@ void tst_QAsn1Element::dateTime_data()
QTest::newRow("GeneralizedTime - no trailing Z")
<< QByteArray::fromHex("180f323035313038323930393533343159")
<< QDateTime();
+ QTest::newRow("GeneralizedTime - invalid month (+8)")
+ << QByteArray::fromHex("180f323035312b3832393039353334315a")
+ << QDateTime();
+ QTest::newRow("GeneralizedTime - invalid date (+9)")
+ << QByteArray::fromHex("180f3230353130382b393039353334315a")
+ << QDateTime();
}
void tst_QAsn1Element::dateTime()