Top Description Inners Fields Constructors Methods
org.apache.sshd.common.cipher

public final Enum ECCurves

extends Enum<ECCurves>
implements KeyTypeIndicator, KeySizeIndicator, NamedResource, OptionalFeature
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.OptionalFeature, org.apache.sshd.common.NamedResource, org.apache.sshd.common.keyprovider.KeySizeIndicator, org.apache.sshd.common.keyprovider.KeyTypeIndicator
Imports
java.io.ByteArrayOutputStream, .EOFException, .IOException, .OutputStream, .StreamCorruptedException, .UncheckedIOException, java.math.BigInteger, java.security.interfaces.ECKey, java.security.spec.ECField, .ECFieldFp, .ECParameterSpec, .ECPoint, .EllipticCurve, java.util.Collections, .Comparator, .EnumSet, .List, .NavigableSet, .Objects, .Set, java.util.stream.Collectors, org.apache.sshd.common.NamedResource, .OptionalFeature, org.apache.sshd.common.config.keys.KeyEntryResolver, org.apache.sshd.common.digest.BuiltinDigests, .Digest, .DigestFactory, org.apache.sshd.common.keyprovider.KeySizeIndicator, .KeyTypeIndicator, org.apache.sshd.common.util.GenericUtils, .NumberUtils, .ValidateUtils, org.apache.sshd.common.util.security.SecurityUtils

Utilities for working with elliptic curves.
Author
Apache MINA SSHD Project

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static enum
ECCurves.ECPointCompression

The various ECPoint representation compression indicators

Field Summary

Modifier and TypeField and Description
public static final Comparator<ECCurves>
private final DigestFactory
public static final NavigableSet<String>
KEY_TYPES

A Set of all the known curves key types

private final int
private final String
private final String
public static final NavigableSet<String>
NAMES

A Set of all the known curves names

public static final ECCurves
public static final ECCurves
public static final ECCurves
private final int
private final String
private final List<Integer>
private final ECParameterSpec
public static final List<ECCurves>
public static final Set<ECCurves>
VALUES

A Set of all the known curves

Constructor Summary

AccessConstructor and Description
private
ECCurves(String name, int[] oid, ECParameterSpec params, int numOctets, DigestFactory digestFactory)

Method Summary

Modifier and TypeMethod and Description
public static byte[]
public static byte[]
private static int
findFirstNonZeroIndex(byte... octets)

public static ECCurves

Returns:

The matching ECCurves instance - null if no match found
fromCurveName
(String
The curve name (case insensitive - ignored if null/empty
name
)

public static ECCurves

Returns:

The matching ECCurves value - null if no match found
fromCurveParameters
(ECParameterSpec
The curve's ECParameterSpec - ignored if null
params
)

public static ECCurves

Returns:

The matching ECCurves value - null if no match found
fromCurveSize
(int
The key size (in bits)
keySize
)

public static ECCurves

Returns:

The matching ECCurves instance - null if no match found
fromECKey
(ECKey
The ECKey - ignored if null
key
)

public static ECCurves

Returns:

The matching ECCurves constant - null if no match found case insensitive
fromKeyType
(String
The key type value - ignored if null/empty
type
)

public static ECCurves
public static ECCurves
fromOIDValue(List<? extends Number> oid)

public static int

Returns:

The curve's key size in bits
getCurveSize
(ECParameterSpec
The curve's ECParameterSpec
params
)

public final Digest

Returns:

The Digest to use when hashing the curve's parameters
getDigestForParams
()

public final int
public final String
public final String
public final int

Returns:

The number of octets used to represent the point(s) for the curve
getNumPointOctets
()

public final String
public final List<Integer>
public final ECParameterSpec
public final boolean
public static ECPoint
octetStringToEcPoint(byte... octets)

public static BigInteger

Returns:

The BigInteger representation of the octet string
octetStringToInteger
(byte...
- octet string bytes to be converted
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)

public static ECCurves
public static ECCurves[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BY_KEY_SIZEback to summary
public static final Comparator<ECCurves> BY_KEY_SIZE
digestFactoryback to summary
private final DigestFactory digestFactory
KEY_TYPESback to summary
public static final NavigableSet<String> KEY_TYPES

A Set of all the known curves key types

keySizeback to summary
private final int keySize
keyTypeback to summary
private final String keyType
nameback to summary
private final String name

Hides java.lang.Enum.name.

NAMESback to summary
public static final NavigableSet<String> NAMES

A Set of all the known curves names

nistp256back to summary
public static final ECCurves nistp256
nistp384back to summary
public static final ECCurves nistp384
nistp521back to summary
public static final ECCurves nistp521
numOctetsback to summary
private final int numOctets
oidStringback to summary
private final String oidString
oidValueback to summary
private final List<Integer> oidValue
paramsback to summary
private final ECParameterSpec params
SORTED_KEY_SIZEback to summary
public static final List<ECCurves> SORTED_KEY_SIZE
VALUESback to summary
public static final Set<ECCurves> VALUES

A Set of all the known curves

Constructor Detail

ECCurvesback to summary
private ECCurves(String name, int[] oid, ECParameterSpec params, int numOctets, DigestFactory digestFactory)

Method Detail

encodeECPointback to summary
public static byte[] encodeECPoint(ECPoint group, ECParameterSpec params)
encodeECPointback to summary
public static byte[] encodeECPoint(ECPoint group, EllipticCurve curve)
findFirstNonZeroIndexback to summary
private static int findFirstNonZeroIndex(byte... octets)
fromCurveNameback to summary
public static ECCurves fromCurveName(String name)
Parameters
name:String

The curve name (case insensitive - ignored if null/empty

Returns:ECCurves

The matching ECCurves instance - null if no match found

fromCurveParametersback to summary
public static ECCurves fromCurveParameters(ECParameterSpec params)
Parameters
params:ECParameterSpec

The curve's ECParameterSpec - ignored if null

Returns:ECCurves

The matching ECCurves value - null if no match found

See Also
getCurveSize(ECParameterSpec), fromCurveSize(int)
fromCurveSizeback to summary
public static ECCurves fromCurveSize(int keySize)
Parameters
keySize:int

The key size (in bits)

Returns:ECCurves

The matching ECCurves value - null if no match found

fromECKeyback to summary
public static ECCurves fromECKey(ECKey key)
Parameters
key:ECKey

The ECKey - ignored if null

Returns:ECCurves

The matching ECCurves instance - null if no match found

fromKeyTypeback to summary
public static ECCurves fromKeyType(String type)
Parameters
type:String

The key type value - ignored if null/empty

Returns:ECCurves

The matching ECCurves constant - null if no match found case insensitive

fromOIDback to summary
public static ECCurves fromOID(String oid)
fromOIDValueback to summary
public static ECCurves fromOIDValue(List<? extends Number> oid)
getCurveSizeback to summary
public static int getCurveSize(ECParameterSpec params)
Parameters
params:ECParameterSpec

The curve's ECParameterSpec

Returns:int

The curve's key size in bits

Exceptions
IllegalArgumentException:
if invalid parameters provided
getDigestForParamsback to summary
public final Digest getDigestForParams()
Returns:Digest

The Digest to use when hashing the curve's parameters

getKeySizeback to summary
public final int getKeySize()

Implements org.apache.sshd.common.keyprovider.KeySizeIndicator.getKeySize.

Returns:int

Doc from org.apache.sshd.common.keyprovider.KeySizeIndicator.getKeySize.

The number of bits used in the key

Annotations
@Override
getKeyTypeback to summary
public final String getKeyType()

Implements org.apache.sshd.common.keyprovider.KeyTypeIndicator.getKeyType.

Returns:String

Doc from org.apache.sshd.common.keyprovider.KeyTypeIndicator.getKeyType.

The SSH key type name - e.g., "ssh-rsa", "sshd-dss" etc.

Annotations
@Override
getNameback to summary
public final String getName()

Implements org.apache.sshd.common.NamedResource.getName.

Returns:String

Doc from org.apache.sshd.common.NamedResource.getName.

The resource name

Annotations
@Override
getNumPointOctetsback to summary
public final int getNumPointOctets()
Returns:int

The number of octets used to represent the point(s) for the curve

getOIDback to summary
public final String getOID()
getOIDValueback to summary
public final List<Integer> getOIDValue()
getParametersback to summary
public final ECParameterSpec getParameters()
isSupportedback to summary
public final boolean isSupported()

Implements org.apache.sshd.common.OptionalFeature.isSupported.

Annotations
@Override
octetStringToEcPointback to summary
public static ECPoint octetStringToEcPoint(byte... octets)
octetStringToIntegerback to summary
public 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

Parameters
octets:byte[]

- octet string bytes to be converted

Returns:BigInteger

The BigInteger representation of the octet string

removeLeadingZeroesback to summary
private static byte[] removeLeadingZeroes(byte[] input)
valueOfback to summary
public static ECCurves valueOf(String name)
valuesback to summary
public static ECCurves[] values()
org.apache.sshd.common.cipher back to summary

public final Class ECCurves.Constants

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final String
ECDSA_SHA2_PREFIX

Standard prefix of NISTP key types when encoded

public static final String
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ECDSA_SHA2_PREFIXback to summary
public static final String ECDSA_SHA2_PREFIX

Standard prefix of NISTP key types when encoded

NISTP256back to summary
public static final String NISTP256
NISTP384back to summary
public static final String NISTP384
NISTP521back to summary
public static final String NISTP521

Constructor Detail

Constantsback to summary
private Constants()
org.apache.sshd.common.cipher back to summary

public sealed Enum ECCurves.ECPointCompression

extends Enum<ECCurves.ECPointCompression>
Class Inheritance

The various ECPoint representation compression indicators
Author
Apache MINA SSHD Project
See Also
RFC-5480 - section 2.2

Field Summary

Modifier and TypeField and Description
private final byte
public static final ECCurves.ECPointCompression
public static final Set<ECCurves.ECPointCompression>
public static final ECCurves.ECPointCompression
public static final ECCurves.ECPointCompression

Constructor Summary

AccessConstructor and Description
private
ECPointCompression(byte indicator)

Method Summary

Modifier and TypeMethod and Description
public byte[]
public static ECCurves.ECPointCompression
fromIndicatorValue(int value)

public final byte
public abstract ECPoint
octetStringToEcPoint(byte[] octets, int startIndex, int len)

public static ECCurves.ECPointCompression
public static ECCurves.ECPointCompression[]
protected void
writeCoordinate(OutputStream s, String n, BigInteger v, int numElements)

public void
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

indicatorValueback to summary
private final byte indicatorValue
UNCOMPRESSEDback to summary
public static final ECCurves.ECPointCompression UNCOMPRESSED
VALUESback to summary
public static final Set<ECCurves.ECPointCompression> VALUES
VARIANT2back to summary
public static final ECCurves.ECPointCompression VARIANT2
VARIANT3back to summary
public static final ECCurves.ECPointCompression VARIANT3

Constructor Detail

ECPointCompressionback to summary
private ECPointCompression(byte indicator)

Method Detail

ecPointToOctetStringback to summary
public byte[] ecPointToOctetString(String curveName, ECPoint p)
fromIndicatorValueback to summary
public static ECCurves.ECPointCompression fromIndicatorValue(int value)
getIndicatorValueback to summary
public final byte getIndicatorValue()
octetStringToEcPointback to summary
public abstract ECPoint octetStringToEcPoint(byte[] octets, int startIndex, int len)
valueOfback to summary
public static ECCurves.ECPointCompression valueOf(String name)
valuesback to summary
public static ECCurves.ECPointCompression[] values()
writeCoordinateback to summary
protected void writeCoordinate(OutputStream s, String n, BigInteger v, int numElements) throws IOException
writeECPointback to summary
public void writeECPoint(OutputStream s, String curveName, ECPoint p) throws IOException