public enum ECCurves extends java.lang.Enum<ECCurves> implements NamedResource, OptionalFeature
Modifier and Type | Class and Description |
---|---|
static class |
ECCurves.Constants |
static class |
ECCurves.ECPointCompression
The various
ECPoint representation compression indicators |
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<ECCurves> |
BY_KEY_SIZE |
private DigestFactory |
digestFactory |
static java.util.NavigableSet<java.lang.String> |
KEY_TYPES
A
Set of all the known curves key types |
private int |
keySize |
private java.lang.String |
keyType |
private java.lang.String |
name |
static java.util.NavigableSet<java.lang.String> |
NAMES
A
Set of all the known curves names |
private int |
numOctets |
private java.lang.String |
oidString |
private java.util.List<java.lang.Integer> |
oidValue |
private java.security.spec.ECParameterSpec |
params |
static java.util.List<ECCurves> |
SORTED_KEY_SIZE |
static java.util.Set<ECCurves> |
VALUES
A
Set of all the known curves |
BY_NAME_COMPARATOR, NAME_EXTRACTOR
FALSE, TRUE
Modifier and Type | Method and Description |
---|---|
static byte[] |
encodeECPoint(java.security.spec.ECPoint group,
java.security.spec.ECParameterSpec params) |
static byte[] |
encodeECPoint(java.security.spec.ECPoint group,
java.security.spec.EllipticCurve curve) |
private static int |
findFirstNonZeroIndex(byte... octets) |
static ECCurves |
fromCurveName(java.lang.String name) |
static ECCurves |
fromCurveParameters(java.security.spec.ECParameterSpec params) |
static ECCurves |
fromCurveSize(int keySize) |
static ECCurves |
fromECKey(java.security.interfaces.ECKey key) |
static ECCurves |
fromKeyType(java.lang.String type) |
static ECCurves |
fromOID(java.lang.String oid) |
static ECCurves |
fromOIDValue(java.util.List<? extends java.lang.Number> oid) |
static int |
getCurveSize(java.security.spec.ECParameterSpec params) |
Digest |
getDigestForParams() |
int |
getKeySize() |
java.lang.String |
getKeyType() |
java.lang.String |
getName() |
int |
getNumPointOctets() |
java.lang.String |
getOID() |
java.util.List<java.lang.Integer> |
getOIDValue() |
java.security.spec.ECParameterSpec |
getParameters() |
boolean |
isSupported() |
static java.security.spec.ECPoint |
octetStringToEcPoint(byte... octets) |
static java.math.BigInteger |
octetStringToInteger(byte... octets)
Converts the given octet string (defined by ASN.1 specifications) to a
BigInteger
As octet strings always represent positive integers, a zero-byte is prepended to
the given array if necessary (if is MSB equal to 1), then this is converted to BigInteger
The conversion is defined in the Section 2.3.8 |
private static byte[] |
removeLeadingZeroes(byte[] input) |
static ECCurves |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static ECCurves[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
findByName, getNameList, getNames, removeByName
all, any, of
public static final ECCurves nistp256
public static final ECCurves nistp384
public static final ECCurves nistp521
public static final java.util.Set<ECCurves> VALUES
Set
of all the known curvespublic static final java.util.NavigableSet<java.lang.String> NAMES
Set
of all the known curves namespublic static final java.util.NavigableSet<java.lang.String> KEY_TYPES
Set
of all the known curves key typespublic static final java.util.Comparator<ECCurves> BY_KEY_SIZE
public static final java.util.List<ECCurves> SORTED_KEY_SIZE
private final java.lang.String name
private final java.lang.String keyType
private final java.lang.String oidString
private final java.util.List<java.lang.Integer> oidValue
private final java.security.spec.ECParameterSpec params
private final int keySize
private final int numOctets
private final DigestFactory digestFactory
public static ECCurves[] values()
for (ECCurves c : ECCurves.values()) System.out.println(c);
public static ECCurves valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic final java.lang.String getName()
getName
in interface NamedResource
public final java.lang.String getOID()
public final java.util.List<java.lang.Integer> getOIDValue()
public final java.lang.String getKeyType()
public final boolean isSupported()
isSupported
in interface OptionalFeature
public final java.security.spec.ECParameterSpec getParameters()
public final int getKeySize()
public final int getNumPointOctets()
public final Digest getDigestForParams()
Digest
to use when hashing the curve's parameterspublic static ECCurves fromKeyType(java.lang.String type)
type
- The key type value - ignored if null
/emptyECCurves
constant - null
if
no match found case insensitivepublic static ECCurves fromCurveName(java.lang.String name)
name
- The curve name (case insensitive - ignored if
null
/emptyECCurves
instance - null
if no
match foundpublic static ECCurves fromECKey(java.security.interfaces.ECKey key)
key
- The ECKey
- ignored if null
ECCurves
instance - null
if no
match foundpublic static ECCurves fromCurveParameters(java.security.spec.ECParameterSpec params)
params
- The curve's ECParameterSpec
- ignored if null
ECCurves
value - null
if no match foundgetCurveSize(ECParameterSpec)
,
fromCurveSize(int)
public static ECCurves fromCurveSize(int keySize)
keySize
- The key size (in bits)ECCurves
value - null
if no
match foundpublic static ECCurves fromOIDValue(java.util.List<? extends java.lang.Number> oid)
public static ECCurves fromOID(java.lang.String oid)
public static int getCurveSize(java.security.spec.ECParameterSpec params)
params
- The curve's ECParameterSpec
java.lang.IllegalArgumentException
- if invalid parameters providedpublic static byte[] encodeECPoint(java.security.spec.ECPoint group, java.security.spec.ECParameterSpec params)
public static byte[] encodeECPoint(java.security.spec.ECPoint group, java.security.spec.EllipticCurve curve)
private static byte[] removeLeadingZeroes(byte[] input)
public static java.math.BigInteger octetStringToInteger(byte... octets)
BigInteger
As octet strings always represent positive integers, a zero-byte is prepended to
the given array if necessary (if is MSB equal to 1), then this is converted to BigInteger
The conversion is defined in the Section 2.3.8octets
- - octet string bytes to be convertedBigInteger
representation of the octet stringpublic static java.security.spec.ECPoint octetStringToEcPoint(byte... octets)
private static int findFirstNonZeroIndex(byte... octets)