qt5base-lts/tests/auto/network
Mårten Nordheim f8e551cf08 Fix loading pkcs#8 encrypted DER-encoded keys in openssl
When we load DER-encoded keys in the openssl-backend we always turn it
into PEM-encoded keys (essentially we prepend and append a header and
footer and use 'toBase64' on the DER data).

The problem comes from the header and footer which is simply chosen
based on which key algorithm was chosen by the user. Which would be
wrong when the key is a PKCS#8 key. This caused OpenSSL to fail when
trying to read it. Surprisingly it still loads correctly for unencrypted
keys with the wrong header, but not for encrypted keys.

This patch adds a small function which checks if a key is an encrypted
PKCS#8 key and then uses this function to figure out if a PKCS#8 header
and footer should be used (note that I only do this for encrypted PKCS#8
keys since, as previously mentioned, unencrypted keys are read correctly
by openssl).

The passphrase is now also passed to the QSslKeyPrivate::decodeDer
function so DER-encoded files can actually be decrypted.

[ChangeLog][QtNetwork][QSslKey] The openssl backend can now load
encrypted PKCS#8 DER-encoded keys.

Task-number: QTBUG-17718
Change-Id: I52eedf19bde297c9aa7fb050e835b3fc0db724e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-04-11 14:30:08 +00:00
..
access QNetworkReply: fix isFinished() for disabled replies 2018-03-17 08:38:29 +00:00
bearer Merge remote-tracking branch 'origin/5.8' into 5.9 2017-03-13 15:55:44 +01:00
kernel Narrow tst_QDnsLookup::lookup blacklist to only CI 2018-04-04 05:05:51 +00:00
socket tst_QLocalSocket: Only expect debug messages if debug level is enabled 2018-03-28 11:40:44 +00:00
ssl Fix loading pkcs#8 encrypted DER-encoded keys in openssl 2018-04-11 14:30:08 +00:00
network.pro