public enum ECCurves extends Enum<ECCurves> implements KeyTypeIndicator, KeySizeIndicator, 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 Comparator<ECCurves> |
BY_KEY_SIZE |
static NavigableSet<String> |
KEY_TYPES
A
Set of all the known curves key types |
static NavigableSet<String> |
NAMES
A
Set of all the known curves names |
static List<ECCurves> |
SORTED_KEY_SIZE |
static 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(ECPoint group,
ECParameterSpec params) |
static byte[] |
encodeECPoint(ECPoint group,
EllipticCurve curve) |
static ECCurves |
fromCurveName(String name) |
static ECCurves |
fromCurveParameters(ECParameterSpec params) |
static ECCurves |
fromCurveSize(int keySize) |
static ECCurves |
fromECKey(ECKey key) |
static ECCurves |
fromKeyType(String type) |
static ECCurves |
fromOID(String oid) |
static ECCurves |
fromOIDValue(List<? extends Number> oid) |
static int |
getCurveSize(ECParameterSpec params) |
Digest |
getDigestForParams() |
int |
getKeySize() |
String |
getKeyType() |
String |
getName() |
int |
getNumPointOctets() |
String |
getOID() |
List<Integer> |
getOIDValue() |
ECParameterSpec |
getParameters() |
boolean |
isSupported() |
static ECPoint |
octetStringToEcPoint(byte... octets) |
static 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 |
static ECCurves |
valueOf(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
groupByKeyType
findByName, findFirstMatchByName, getNameList, getNames, ofName, removeByName, safeCompareByName
all, any, of
public static final ECCurves nistp256
public static final ECCurves nistp384
public static final ECCurves nistp521
public static final NavigableSet<String> NAMES
Set
of all the known curves namespublic static final NavigableSet<String> KEY_TYPES
Set
of all the known curves key typespublic static final Comparator<ECCurves> BY_KEY_SIZE
public static ECCurves[] values()
for (ECCurves c : ECCurves.values()) System.out.println(c);
public static ECCurves valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic final String getName()
getName
in interface NamedResource
public final String getOID()
public final String getKeyType()
getKeyType
in interface KeyTypeIndicator
public final boolean isSupported()
isSupported
in interface OptionalFeature
public final ECParameterSpec getParameters()
public final int getKeySize()
getKeySize
in interface KeySizeIndicator
public final int getNumPointOctets()
public final Digest getDigestForParams()
Digest
to use when hashing the curve's parameterspublic static ECCurves fromKeyType(String type)
type
- The key type value - ignored if null
/emptyECCurves
constant - null
if no match found case insensitivepublic static ECCurves fromCurveName(String name)
name
- The curve name (case insensitive - ignored if null
/emptyECCurves
instance - null
if no match foundpublic static ECCurves fromCurveParameters(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 int getCurveSize(ECParameterSpec params)
params
- The curve's ECParameterSpec
IllegalArgumentException
- if invalid parameters providedpublic static byte[] encodeECPoint(ECPoint group, ECParameterSpec params)
public static byte[] encodeECPoint(ECPoint group, EllipticCurve curve)
public static 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 ECPoint octetStringToEcPoint(byte... octets)
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.