what-the-bank/sources/org/bouncycastle/crypto/signers/RandomDSAKCalculator.java

39 lines
1.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.signers;
import java.math.BigInteger;
import java.security.SecureRandom;
/* loaded from: classes6.dex */
public class RandomDSAKCalculator implements DSAKCalculator {
private static final BigInteger ZERO = BigInteger.valueOf(0);
private BigInteger q;
private SecureRandom random;
@Override // org.bouncycastle.crypto.signers.DSAKCalculator
public boolean isDeterministic() {
return false;
}
@Override // org.bouncycastle.crypto.signers.DSAKCalculator
public BigInteger nextK() {
int bitLength = this.q.bitLength();
while (true) {
BigInteger bigInteger = new BigInteger(bitLength, this.random);
if (!bigInteger.equals(ZERO) && bigInteger.compareTo(this.q) < 0) {
return bigInteger;
}
}
}
@Override // org.bouncycastle.crypto.signers.DSAKCalculator
public void init(BigInteger bigInteger, SecureRandom secureRandom) {
this.q = bigInteger;
this.random = secureRandom;
}
@Override // org.bouncycastle.crypto.signers.DSAKCalculator
public void init(BigInteger bigInteger, BigInteger bigInteger2, byte[] bArr) {
throw new IllegalStateException("Operation not supported");
}
}