Minor pq usage tweak

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