summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
diff options
context:
space:
mode:
authorAndré Klitzing <aklitzing@gmail.com>2014-11-18 10:18:18 +0100
committerAndré Klitzing <aklitzing@gmail.com>2015-01-18 10:18:43 +0100
commit962ea5690cb9351822c30da534ecae7aeeba667d (patch)
treec3fef960ae04c61bd55426cc05c7a910b8b48f52 /tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
parenta6a865e24999bf878f6f80341b7fc14f2b67a05e (diff)
Add elliptic curve support to QSsl
Add possibility to get length and other information of EC based certificates. Also it is possible to parse those public/private keys from PEM and DER encoded files. Based on patch by Remco Bloemen [ChangeLog][QtNetwork][SSL/TLS support] It is now possible to parse elliptic curve certificates. Change-Id: I4b11f726296aecda89c3cbd195d7c817ae6fc47b Task-number: QTBUG-18972 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp')
-rw-r--r--tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
index 8083662d40..ddd8cb64aa 100644
--- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
+++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp
@@ -105,12 +105,13 @@ void tst_QSslKey::initTestCase()
QDir dir(testDataDir + "/keys");
QFileInfoList fileInfoList = dir.entryInfoList(QDir::Files | QDir::Readable);
- QRegExp rx(QLatin1String("^(rsa|dsa)-(pub|pri)-(\\d+)\\.(pem|der)$"));
+ QRegExp rx(QLatin1String("^(rsa|dsa|ec)-(pub|pri)-(\\d+)-?\\w*\\.(pem|der)$"));
foreach (QFileInfo fileInfo, fileInfoList) {
if (rx.indexIn(fileInfo.fileName()) >= 0)
keyInfoList << KeyInfo(
fileInfo,
- rx.cap(1) == QLatin1String("rsa") ? QSsl::Rsa : QSsl::Dsa,
+ rx.cap(1) == QLatin1String("rsa") ? QSsl::Rsa :
+ (rx.cap(1) == QLatin1String("dsa") ? QSsl::Dsa : QSsl::Ec),
rx.cap(2) == QLatin1String("pub") ? QSsl::PublicKey : QSsl::PrivateKey,
rx.cap(3).toInt(),
rx.cap(4) == QLatin1String("pem") ? QSsl::Pem : QSsl::Der);
@@ -279,7 +280,8 @@ void tst_QSslKey::toEncryptedPemOrDer_data()
foreach (KeyInfo keyInfo, keyInfoList) {
foreach (QString password, passwords) {
QString testName = QString("%1-%2-%3-%4-%5").arg(keyInfo.fileInfo.fileName())
- .arg(keyInfo.algorithm == QSsl::Rsa ? "RSA" : "DSA")
+ .arg(keyInfo.algorithm == QSsl::Rsa ? "RSA" :
+ (keyInfo.algorithm == QSsl::Dsa ? "DSA" : "EC"))
.arg(keyInfo.type == QSsl::PrivateKey ? "PrivateKey" : "PublicKey")
.arg(keyInfo.format == QSsl::Pem ? "PEM" : "DER")
.arg(password);