what-the-bank/sources/org/bouncycastle/asn1/nist/NISTNamedCurves.java

63 lines
2.4 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.nist;
import java.util.Enumeration;
import java.util.Hashtable;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.sec.SECNamedCurves;
import org.bouncycastle.asn1.sec.SECObjectIdentifiers;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.util.Strings;
/* loaded from: classes6.dex */
public class NISTNamedCurves {
static final Hashtable objIds = new Hashtable();
static final Hashtable names = new Hashtable();
public static ASN1ObjectIdentifier getOID(String str) {
return (ASN1ObjectIdentifier) objIds.get(Strings.toUpperCase(str));
}
public static Enumeration getNames() {
return objIds.keys();
}
public static String getName(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
return (String) names.get(aSN1ObjectIdentifier);
}
public static X9ECParameters getByOID(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
return SECNamedCurves.getByOID(aSN1ObjectIdentifier);
}
public static X9ECParameters getByName(String str) {
ASN1ObjectIdentifier aSN1ObjectIdentifier = (ASN1ObjectIdentifier) objIds.get(Strings.toUpperCase(str));
if (aSN1ObjectIdentifier != null) {
return getByOID(aSN1ObjectIdentifier);
}
return null;
}
static void defineCurve(String str, ASN1ObjectIdentifier aSN1ObjectIdentifier) {
objIds.put(str, aSN1ObjectIdentifier);
names.put(aSN1ObjectIdentifier, str);
}
static {
defineCurve("B-571", SECObjectIdentifiers.sect571r1);
defineCurve("B-409", SECObjectIdentifiers.sect409r1);
defineCurve("B-283", SECObjectIdentifiers.sect283r1);
defineCurve("B-233", SECObjectIdentifiers.sect233r1);
defineCurve("B-163", SECObjectIdentifiers.sect163r2);
defineCurve("K-571", SECObjectIdentifiers.sect571k1);
defineCurve("K-409", SECObjectIdentifiers.sect409k1);
defineCurve("K-283", SECObjectIdentifiers.sect283k1);
defineCurve("K-233", SECObjectIdentifiers.sect233k1);
defineCurve("K-163", SECObjectIdentifiers.sect163k1);
defineCurve("P-521", SECObjectIdentifiers.secp521r1);
defineCurve("P-384", SECObjectIdentifiers.secp384r1);
defineCurve("P-256", SECObjectIdentifiers.secp256r1);
defineCurve("P-224", SECObjectIdentifiers.secp224r1);
defineCurve("P-192", SECObjectIdentifiers.secp192r1);
}
}