aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/base/QXmppSasl.cpp4
-rw-r--r--tests/qxmppsasl/tst_qxmppsasl.cpp1
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",