diff options
author | Jeremy Lainé <jeremy.laine@m4x.org> | 2014-08-28 23:56:03 +0200 |
---|---|---|
committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2014-08-29 23:18:22 +0200 |
commit | 6a4cb8d62b9ba68666e6d89f101a571da18432cb (patch) | |
tree | 8358e64d66d90cabc2998ac1836ba0c830f31829 /tests/auto/network | |
parent | def5a56b0316edcf95693c86e86b80b338fbbba4 (diff) |
ssl: Add common key parser for backends
This internal implementation of QSslKey can be used when OpenSSL is not
available. Encrypted keys are not supported, as the cryptography must
be supplied by a separate library.
With this commit, WinRT is migrated to the new implementation,
but qsslkey_winrt.cpp is left in place so that the missing crypto
implementation can be added later. This also means most of the expected
failures for that platform can be removed from the autotest.
Change-Id: I24a3ad1053bb72311613b28b3ae845aa1645a321
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'tests/auto/network')
-rw-r--r-- | tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index f7b9bcba62..445fdc7df4 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -47,14 +47,6 @@ #include <QtNetwork/qhostaddress.h> #include <QtNetwork/qnetworkproxy.h> -#ifdef Q_OS_WINRT -#define WINRT_EXPECT_FAILURES \ - if (type == QSsl::PrivateKey) \ - QEXPECT_FAIL("", "No support for private keys on WinRT: QTBUG-40688", Abort); \ - if (strstr(QTest::currentDataTag(), "rsa-pub-40")) \ - QEXPECT_FAIL("", "Weak public keys are not supported on WinRT", Abort); -#endif - class tst_QSslKey : public QObject { Q_OBJECT @@ -179,10 +171,6 @@ void tst_QSslKey::constructor() QFETCH(QSsl::KeyType, type); QFETCH(QSsl::EncodingFormat, format); -#ifdef Q_OS_WINRT - WINRT_EXPECT_FAILURES -#endif - QByteArray encoded = readFile(absFilePath); QSslKey key(encoded, algorithm, format, type); QVERIFY(!key.isNull()); @@ -244,10 +232,6 @@ void tst_QSslKey::length() QFETCH(int, length); QFETCH(QSsl::EncodingFormat, format); -#ifdef Q_OS_WINRT - WINRT_EXPECT_FAILURES -#endif - QByteArray encoded = readFile(absFilePath); QSslKey key(encoded, algorithm, format, type); QVERIFY(!key.isNull()); @@ -269,10 +253,6 @@ void tst_QSslKey::toPemOrDer() QFETCH(QSsl::KeyType, type); QFETCH(QSsl::EncodingFormat, format); -#ifdef Q_OS_WINRT - WINRT_EXPECT_FAILURES -#endif - QByteArray encoded = readFile(absFilePath); QSslKey key(encoded, algorithm, format, type); QVERIFY(!key.isNull()); @@ -317,10 +297,6 @@ void tst_QSslKey::toEncryptedPemOrDer() QFETCH(QSsl::EncodingFormat, format); QFETCH(QString, password); -#ifdef Q_OS_WINRT - WINRT_EXPECT_FAILURES -#endif - QByteArray plain = readFile(absFilePath); QSslKey key(plain, algorithm, format, type); QVERIFY(!key.isNull()); @@ -328,6 +304,9 @@ void tst_QSslKey::toEncryptedPemOrDer() QByteArray pwBytes(password.toLatin1()); if (type == QSsl::PrivateKey) { +#ifdef QT_NO_OPENSSL + QSKIP("Encrypted keys require support from the SSL backend"); +#endif QByteArray encryptedPem = key.toPem(pwBytes); QVERIFY(!encryptedPem.isEmpty()); QSslKey keyPem(encryptedPem, algorithm, QSsl::Pem, type, pwBytes); @@ -398,8 +377,8 @@ void tst_QSslKey::passphraseChecks() QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey, "WRONG!"); QVERIFY(key.isNull()); // wrong passphrase => should not be able to decode key } -#ifdef Q_OS_WINRT - QEXPECT_FAIL("", "The WinRT backend does not support private key imports: QTBUG-40688", Abort); +#ifdef QT_NO_OPENSSL + QEXPECT_FAIL("", "Encrypted keys require support from the SSL backend", Abort); #endif { if (!keyFile.isOpen()) |