what-the-bank/sources/org/bouncycastle/asn1/anssi/ANSSINamedCurves.java

80 lines
3.5 KiB
Java

package org.bouncycastle.asn1.anssi;
import java.math.BigInteger;
import java.util.Enumeration;
import java.util.Hashtable;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.asn1.x9.X9ECParametersHolder;
import org.bouncycastle.asn1.x9.X9ECPoint;
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.util.Strings;
import org.bouncycastle.util.encoders.Hex;
/* loaded from: classes6.dex */
public class ANSSINamedCurves {
static X9ECParametersHolder FRP256v1 = new X9ECParametersHolder() { // from class: org.bouncycastle.asn1.anssi.ANSSINamedCurves.1
@Override // org.bouncycastle.asn1.x9.X9ECParametersHolder
public final X9ECParameters createParameters() {
BigInteger fromHex = ANSSINamedCurves.fromHex("F1FD178C0B3AD58F10126DE8CE42435B3961ADBCABC8CA6DE8FCF353D86E9C03");
BigInteger fromHex2 = ANSSINamedCurves.fromHex("F1FD178C0B3AD58F10126DE8CE42435B3961ADBCABC8CA6DE8FCF353D86E9C00");
BigInteger fromHex3 = ANSSINamedCurves.fromHex("EE353FCA5428A9300D4ABA754A44C00FDFEC0C9AE4B1A1803075ED967B7BB73F");
BigInteger fromHex4 = ANSSINamedCurves.fromHex("F1FD178C0B3AD58F10126DE8CE42435B53DC67E140D2BF941FFDD459C6D655E1");
BigInteger valueOf = BigInteger.valueOf(1L);
ECCurve configureCurve = ANSSINamedCurves.configureCurve(new ECCurve.Fp(fromHex, fromHex2, fromHex3, fromHex4, valueOf));
return new X9ECParameters(configureCurve, new X9ECPoint(configureCurve, Hex.decode("04B6B3D4C356C139EB31183D4749D423958C27D2DCAF98B70164C97A2DD98F5CFF6142E0F7C8B204911F9271F0F3ECEF8C2701C307E8E4C9E183115A1554062CFB")), fromHex4, valueOf, (byte[]) null);
}
};
static final Hashtable objIds = new Hashtable();
static final Hashtable curves = new Hashtable();
static final Hashtable names = new Hashtable();
/* JADX INFO: Access modifiers changed from: private */
public static ECCurve configureCurve(ECCurve eCCurve) {
return eCCurve;
}
public static ASN1ObjectIdentifier getOID(String str) {
return (ASN1ObjectIdentifier) objIds.get(Strings.toLowerCase(str));
}
public static Enumeration getNames() {
return names.elements();
}
public static String getName(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
return (String) names.get(aSN1ObjectIdentifier);
}
public static X9ECParameters getByOID(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
X9ECParametersHolder x9ECParametersHolder = (X9ECParametersHolder) curves.get(aSN1ObjectIdentifier);
if (x9ECParametersHolder == null) {
return null;
}
return x9ECParametersHolder.getParameters();
}
public static X9ECParameters getByName(String str) {
ASN1ObjectIdentifier oid = getOID(str);
if (oid == null) {
return null;
}
return getByOID(oid);
}
/* JADX INFO: Access modifiers changed from: private */
public static BigInteger fromHex(String str) {
return new BigInteger(1, Hex.decode(str));
}
static void defineCurve(String str, ASN1ObjectIdentifier aSN1ObjectIdentifier, X9ECParametersHolder x9ECParametersHolder) {
objIds.put(str.toLowerCase(), aSN1ObjectIdentifier);
names.put(aSN1ObjectIdentifier, str);
curves.put(aSN1ObjectIdentifier, x9ECParametersHolder);
}
static {
defineCurve("FRP256v1", ANSSIObjectIdentifiers.FRP256v1, FRP256v1);
}
}