From 768eadde36b29ccd5aeb200437066ae52a5fb0cd Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 1 Aug 2017 12:27:26 +0200 Subject: [PATCH] use random string generator instead of BigInteger in DigestMd5 --- .../java/eu/siacs/conversations/crypto/sasl/DigestMd5.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java b/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java index 8b16215bd..3bf5fe342 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java @@ -2,7 +2,6 @@ package eu.siacs.conversations.crypto.sasl; import android.util.Base64; -import java.math.BigInteger; import java.nio.charset.Charset; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -52,7 +51,7 @@ public class DigestMd5 extends SaslMechanism { + account.getPassword(); final MessageDigest md = MessageDigest.getInstance("MD5"); final byte[] y = md.digest(x.getBytes(Charset.defaultCharset())); - final String cNonce = new BigInteger(100, rng).toString(32); + final String cNonce = CryptoHelper.random(100,rng); final byte[] a1 = CryptoHelper.concatenateByteArrays(y, (":" + nonce + ":" + cNonce).getBytes(Charset.defaultCharset())); final String a2 = "AUTHENTICATE:" + digestUri;