From 962ea5690cb9351822c30da534ecae7aeeba667d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Tue, 18 Nov 2014 10:18:18 +0100 Subject: 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 --- tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp') 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); -- cgit v1.2.3