Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.bouncycastle.asn1.nist;
 
 
Utility class for fetching curves using their NIST names as published in FIPS-PUB 186-3
public class NISTNamedCurves
    static final Hashtable objIds = new Hashtable();
    static final Hashtable names = new Hashtable();
    static void defineCurve(String nameASN1ObjectIdentifier oid)
    {
        .put(nameoid);
        .put(oidname);
    }
    static
    {
        defineCurve("B-571".);
        defineCurve("B-409".);
        defineCurve("B-283".);
        defineCurve("B-233".);
        defineCurve("B-163".);
        defineCurve("K-571".);
        defineCurve("K-409".);
        defineCurve("K-283".);
        defineCurve("K-233".);
        defineCurve("K-163".);
        defineCurve("P-521".);
        defineCurve("P-384".);
        defineCurve("P-256".);
        defineCurve("P-224".);
        defineCurve("P-192".);
    }
    public static X9ECParameters getByName(
        String  name)
    {
        ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier).get(Strings.toUpperCase(name));
        if (oid != null)
        {
            return getByOID(oid);
        }
        return null;
    }

    
return the X9ECParameters object for the named curve represented by the passed in object identifier. Null if the curve isn't present.

Parameters:
oid an object identifier representing a named curve, if present.
    public static X9ECParameters getByOID(
        ASN1ObjectIdentifier  oid)
    {
        return SECNamedCurves.getByOID(oid);
    }

    
return the object identifier signified by the passed in name. Null if there is no object identifier associated with name.

Returns:
the object identifier associated with name, if present.
    public static ASN1ObjectIdentifier getOID(
        String  name)
    {
        return (ASN1ObjectIdentifier).get(Strings.toUpperCase(name));
    }

    
return the named curve name represented by the given object identifier.
    public static String getName(
        ASN1ObjectIdentifier  oid)
    {
        return (String).get(oid);
    }

    
returns an enumeration containing the name strings for curves contained in this structure.
    public static Enumeration getNames()
    {
        return .keys();
    }
New to GrepCode? Check out our FAQ X