diff options
| author | Linus Jahn <lnj@kaidan.im> | 2020-10-31 19:47:50 +0100 |
|---|---|---|
| committer | LNJ <lnj@kaidan.im> | 2020-10-31 20:05:32 +0100 |
| commit | e2cf93b29007afb4e71a5591c50843be9ad58adc (patch) | |
| tree | cb12e1b1b32a8c66905f5a8fb6ab73d6c36173d5 | |
| parent | ca76b24e1af920cbc2c07b950dd1dad81ff98dc5 (diff) | |
| download | qxmpp-e2cf93b29007afb4e71a5591c50843be9ad58adc.tar.gz | |
Add SCRAM-SHA-512 SASL algorithm
| -rw-r--r-- | src/base/QXmppSasl.cpp | 4 | ||||
| -rw-r--r-- | tests/qxmppsasl/tst_qxmppsasl.cpp | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/base/QXmppSasl.cpp b/src/base/QXmppSasl.cpp index 2a799a64..ebc3c99c 100644 --- a/src/base/QXmppSasl.cpp +++ b/src/base/QXmppSasl.cpp @@ -42,6 +42,7 @@ static QByteArray forcedNonce; static const QMap<QString, QCryptographicHash::Algorithm> SCRAM_ALGORITHMS = { { QStringLiteral("SCRAM-SHA-1"), QCryptographicHash::Sha1 }, { QStringLiteral("SCRAM-SHA-256"), QCryptographicHash::Sha256 }, + { QStringLiteral("SCRAM-SHA-512"), QCryptographicHash::Sha512 }, }; // Returns the hash length in bytes (QCH::hashLength() only exists since 5.12). @@ -55,6 +56,8 @@ int hashLength(QCryptographicHash::Algorithm algorithm) return 160 / 8; case QCryptographicHash::Sha256: return 256 / 8; + case QCryptographicHash::Sha512: + return 512 / 8; default: return QCryptographicHash::hash({}, algorithm).size(); } @@ -296,6 +299,7 @@ QXmppSaslClient::~QXmppSaslClient() QStringList QXmppSaslClient::availableMechanisms() { return { + QStringLiteral("SCRAM-SHA-512"), QStringLiteral("SCRAM-SHA-256"), QStringLiteral("SCRAM-SHA-1"), QStringLiteral("DIGEST-MD5"), diff --git a/tests/qxmppsasl/tst_qxmppsasl.cpp b/tests/qxmppsasl/tst_qxmppsasl.cpp index cb216ba7..78367800 100644 --- a/tests/qxmppsasl/tst_qxmppsasl.cpp +++ b/tests/qxmppsasl/tst_qxmppsasl.cpp @@ -191,6 +191,7 @@ void tst_QXmppSasl::testSuccess() void tst_QXmppSasl::testClientAvailableMechanisms() { const QStringList expectedMechanisms = { + "SCRAM-SHA-512", "SCRAM-SHA-256", "SCRAM-SHA-1", "DIGEST-MD5", |
