what-the-bank/sources/org/bouncycastle/crypto/tls/DefaultTlsSRPGroupVerifier....

51 lines
1.9 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.tls;
import java.math.BigInteger;
import java.util.Vector;
import org.bouncycastle.crypto.agreement.srp.SRP6StandardGroups;
import org.bouncycastle.crypto.params.SRP6GroupParameters;
/* loaded from: classes6.dex */
public class DefaultTlsSRPGroupVerifier implements TlsSRPGroupVerifier {
protected static final Vector DEFAULT_GROUPS;
protected Vector groups;
protected boolean areParametersEqual(BigInteger bigInteger, BigInteger bigInteger2) {
return bigInteger == bigInteger2 || bigInteger.equals(bigInteger2);
}
protected boolean areGroupsEqual(SRP6GroupParameters sRP6GroupParameters, SRP6GroupParameters sRP6GroupParameters2) {
return sRP6GroupParameters == sRP6GroupParameters2 || (areParametersEqual(sRP6GroupParameters.getN(), sRP6GroupParameters2.getN()) && areParametersEqual(sRP6GroupParameters.getG(), sRP6GroupParameters2.getG()));
}
@Override // org.bouncycastle.crypto.tls.TlsSRPGroupVerifier
public boolean accept(SRP6GroupParameters sRP6GroupParameters) {
for (int i = 0; i < this.groups.size(); i++) {
if (areGroupsEqual(sRP6GroupParameters, (SRP6GroupParameters) this.groups.elementAt(i))) {
return true;
}
}
return false;
}
public DefaultTlsSRPGroupVerifier(Vector vector) {
this.groups = vector;
}
public DefaultTlsSRPGroupVerifier() {
this(DEFAULT_GROUPS);
}
static {
Vector vector = new Vector();
DEFAULT_GROUPS = vector;
vector.addElement(SRP6StandardGroups.rfc5054_1024);
vector.addElement(SRP6StandardGroups.rfc5054_1536);
vector.addElement(SRP6StandardGroups.rfc5054_2048);
vector.addElement(SRP6StandardGroups.rfc5054_3072);
vector.addElement(SRP6StandardGroups.rfc5054_4096);
vector.addElement(SRP6StandardGroups.rfc5054_6144);
vector.addElement(SRP6StandardGroups.rfc5054_8192);
}
}