Minor pq usage tweak

master
Lonami Exo 2018-07-25 19:45:51 +02:00
parent 21eb87781e
commit 7cfd9034d0
1 changed files with 6 additions and 8 deletions

View File

@ -26,18 +26,16 @@ public class Authenticator {
// Note that Java uses big endian, which is correct here
final BigInteger pq = new BigInteger(resPq.pq());
final Pair<BigInteger, BigInteger> pqPair = Utils.factorize(pq);
final BigInteger p = pqPair.getKey();
final BigInteger q = pqPair.getValue();
// Once again, as big endian
final byte[] pBytes = p.toByteArray();
final byte[] qBytes = q.toByteArray();
final byte[] p = pqPair.getKey().toByteArray();
final byte[] q = pqPair.getValue().toByteArray();
final BigInteger newNonce = new BigInteger(Utils.randomBytes(32));
final byte[] pqInnerData = new Types.PQInnerData()
.pq(resPq.pq())
.p(pBytes)
.q(qBytes)
.p(p)
.q(q)
.nonce(resPq.nonce())
.serverNonce(resPq.serverNonce())
.newNonce(newNonce)
@ -61,8 +59,8 @@ public class Authenticator {
new Functions.ReqDHParams()
.nonce(resPq.nonce())
.serverNonce(resPq.serverNonce())
.p(pBytes)
.q(qBytes)
.p(p)
.q(q)
.publicKeyFingerprint(targetFingerprint)
.encryptedData(cipherText)
);