diff options
author | Andrew Knight <andrew.knight@digia.com> | 2014-08-12 12:21:57 +0300 |
---|---|---|
committer | Andrew Knight <andrew.knight@digia.com> | 2014-08-13 21:09:51 +0200 |
commit | 8c864ac49861b397a6d3e8b4a93c39b1ed373644 (patch) | |
tree | c82b95c1d52892397f59f50c3fc9be8f43b69d41 /tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | |
parent | cec893e4f0d6480a9b3e38af38c7b887a29f206d (diff) |
winrt: Add partial SSL key support
This allows for opening of public key files. It does not, however,
support opening private keys (or decrypting/encrypting them). This is
due to limitations in the native API.
Nearly all public key tests pass (the native API doesn't support the
40-bit key in the test set). The private key tests are expected to fail.
Task-number: QTBUG-40688
Change-Id: Id8f2f1ae6526540736ceb2e5371f6a5d80c4ba7b
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp')
-rw-r--r-- | tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp index e735e463ee..f7b9bcba62 100644 --- a/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/network/ssl/qsslkey/tst_qsslkey.cpp @@ -47,6 +47,14 @@ #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 @@ -171,6 +179,10 @@ 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()); @@ -232,6 +244,10 @@ 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()); @@ -253,6 +269,10 @@ 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()); @@ -297,6 +317,10 @@ 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()); @@ -374,6 +398,9 @@ 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); +#endif { if (!keyFile.isOpen()) keyFile.open(QIODevice::ReadOnly); |