// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.asn1.anssi;

import java.util.Enumeration;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.util.Strings;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import java.math.BigInteger;
import org.bouncycastle.math.ec.WNafUtil;
import org.bouncycastle.util.encoders.Hex;
import org.bouncycastle.asn1.x9.X9ECPoint;
import org.bouncycastle.math.ec.ECCurve;
import java.util.Hashtable;
import org.bouncycastle.asn1.x9.X9ECParametersHolder;

public class ANSSINamedCurves
{
    static X9ECParametersHolder FRP256v1;
    static final Hashtable objIds;
    static final Hashtable curves;
    static final Hashtable names;
    
    private static X9ECPoint configureBasepoint(final ECCurve ecCurve, final String s) {
        final X9ECPoint x9ECPoint = new X9ECPoint(ecCurve, Hex.decodeStrict(s));
        WNafUtil.configureBasepoint(x9ECPoint.getPoint());
        return x9ECPoint;
    }
    
    private static ECCurve configureCurve(final ECCurve ecCurve) {
        return ecCurve;
    }
    
    private static BigInteger fromHex(final String s) {
        return new BigInteger(1, Hex.decodeStrict(s));
    }
    
    static void defineCurve(final String value, final ASN1ObjectIdentifier key, final X9ECParametersHolder value2) {
        ANSSINamedCurves.objIds.put(Strings.toLowerCase(value), key);
        ANSSINamedCurves.names.put(key, value);
        ANSSINamedCurves.curves.put(key, value2);
    }
    
    public static X9ECParameters getByName(final String s) {
        final ASN1ObjectIdentifier oid = getOID(s);
        return (oid == null) ? null : getByOID(oid);
    }
    
    public static X9ECParametersHolder getByNameLazy(final String s) {
        final ASN1ObjectIdentifier oid = getOID(s);
        return (oid == null) ? null : getByOIDLazy(oid);
    }
    
    public static X9ECParameters getByOID(final ASN1ObjectIdentifier asn1ObjectIdentifier) {
        final X9ECParametersHolder byOIDLazy = getByOIDLazy(asn1ObjectIdentifier);
        return (byOIDLazy == null) ? null : byOIDLazy.getParameters();
    }
    
    public static X9ECParametersHolder getByOIDLazy(final ASN1ObjectIdentifier key) {
        return ANSSINamedCurves.curves.get(key);
    }
    
    public static ASN1ObjectIdentifier getOID(final String s) {
        return ANSSINamedCurves.objIds.get(Strings.toLowerCase(s));
    }
    
    public static String getName(final ASN1ObjectIdentifier key) {
        return ANSSINamedCurves.names.get(key);
    }
    
    public static Enumeration getNames() {
        return ANSSINamedCurves.names.elements();
    }
    
    static {
        ANSSINamedCurves.FRP256v1 = new X9ECParametersHolder() {
            @Override
            protected ECCurve createCurve() {
                return configureCurve(new ECCurve.Fp(fromHex("F1FD178C0B3AD58F10126DE8CE42435B3961ADBCABC8CA6DE8FCF353D86E9C03"), fromHex("F1FD178C0B3AD58F10126DE8CE42435B3961ADBCABC8CA6DE8FCF353D86E9C00"), fromHex("EE353FCA5428A9300D4ABA754A44C00FDFEC0C9AE4B1A1803075ED967B7BB73F"), fromHex("F1FD178C0B3AD58F10126DE8CE42435B53DC67E140D2BF941FFDD459C6D655E1"), BigInteger.valueOf(1L), true));
            }
            
            @Override
            protected X9ECParameters createParameters() {
                final byte[] array = null;
                final ECCurve curve = this.createCurve();
                return new X9ECParameters(curve, configureBasepoint(curve, "04B6B3D4C356C139EB31183D4749D423958C27D2DCAF98B70164C97A2DD98F5CFF6142E0F7C8B204911F9271F0F3ECEF8C2701C307E8E4C9E183115A1554062CFB"), curve.getOrder(), curve.getCofactor(), array);
            }
        };
        objIds = new Hashtable();
        curves = new Hashtable();
        names = new Hashtable();
        defineCurve("FRP256v1", ANSSIObjectIdentifiers.FRP256v1, ANSSINamedCurves.FRP256v1);
    }
}
