SSL backend: Add a decodeDer() method to the private API
This allows QSslKey to avoid converting to pem format if the backend supports native der decoding. Change-Id: I0822a21401ad0ca81c6eeb6c7d53c421e1e2e93a Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
2fe8efbefe
commit
259cf68e06
@ -109,6 +109,12 @@ bool QSslKeyPrivate::fromEVP_PKEY(EVP_PKEY *pkey)
|
||||
return false;
|
||||
}
|
||||
|
||||
void QSslKeyPrivate::decodeDer(const QByteArray &der, const QByteArray &passPhrase,
|
||||
bool deepClear)
|
||||
{
|
||||
decodePem(pemFromDer(der), passPhrase, deepClear);
|
||||
}
|
||||
|
||||
void QSslKeyPrivate::decodePem(const QByteArray &pem, const QByteArray &passPhrase,
|
||||
bool deepClear)
|
||||
{
|
||||
|
@ -189,9 +189,10 @@ QSslKey::QSslKey(const QByteArray &encoded, QSsl::KeyAlgorithm algorithm,
|
||||
{
|
||||
d->type = type;
|
||||
d->algorithm = algorithm;
|
||||
d->decodePem((encoding == QSsl::Der)
|
||||
? d->pemFromDer(encoded) : encoded,
|
||||
passPhrase);
|
||||
if (encoding == QSsl::Der)
|
||||
d->decodeDer(encoded, passPhrase);
|
||||
else
|
||||
d->decodePem(encoded, passPhrase);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
void clear(bool deep = true);
|
||||
|
||||
bool fromEVP_PKEY(EVP_PKEY *pkey);
|
||||
void decodeDer(const QByteArray &der, const QByteArray &passPhrase,
|
||||
bool deepClear = true);
|
||||
void decodePem(const QByteArray &pem, const QByteArray &passPhrase,
|
||||
bool deepClear = true);
|
||||
QByteArray pemHeader() const;
|
||||
|
Loading…
Reference in New Issue
Block a user