Top Description Fields Methods
org.apache.sshd.common.util.security.eddsa.generic

public Interface EdDSASupport<PUB extends PublicKey, PRV extends PrivateKey>

Known Direct Implementers
org.apache.sshd.common.util.security.eddsa.NetI2pCryptoEdDSASupport, org.apache.sshd.common.util.security.eddsa.bouncycastle.BouncyCastleEdDSASupport
Type Parameters
<PUB>
type of the public key supported by the security provider
<PRV>
type of the private key supported by the security provider
Imports
java.io.IOException, .StreamCorruptedException, java.security.GeneralSecurityException, .Key, .KeyPair, .PrivateKey, .PublicKey, java.security.spec.KeySpec, org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder, .PublicKeyEntryDecoder, org.apache.sshd.common.keyprovider.KeyPairProvider, org.apache.sshd.common.signature.Signature, org.apache.sshd.common.util.buffer.Buffer, org.apache.sshd.common.util.io.der.ASN1Object, .ASN1Type, .DERParser, org.apache.sshd.common.util.security.SecurityUtils

Provides generic operations required of a security provider to support EdDSA and Ed25519.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final String
public static final int

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if both keys are instances of the public key type associated with the security provider and they are equal.
compareEDDSAPPublicKeys
(PublicKey
the first key
k1
,
PublicKey
the second key
k2
)

public boolean

Returns:

true if both keys are instances of the private key type associated with the security provider and they are equal.
compareEDDSAPrivateKeys
(PrivateKey
the first key
k1
,
PrivateKey
the second key
k2
)

public KeySpec

Returns:

a key spec from the private key
createPrivateKeySpec
(PRV
the private key
privateKey
)

public KeySpec

Returns:

a key spec from the public key
createPublicKeySpec
(PUB
the public key
publicKey
)

public static KeyPair

Returns:

a KeyPair from the given raw private key data.
decodeEd25519KeyPair
(byte[]
the raw private key bytes.
keyData
)

public static PrivateKey

Returns:

the associated private key.
decodeEdDSAPrivateKey
(byte[]
the raw private key bytes.
keyData
)

public PRV

Returns:

the associated private key
generateEDDSAPrivateKey
(byte[]
the raw private key bytes
seed
)

public PUB

Returns:

the associated public key
generateEDDSAPublicKey
(byte[]
the raw public key bytes
seed
)

public int

Returns:

the size of the key if it is an EdDSA key, -1 otherwise.
getEDDSAKeySize
(Key
the key to get the size of.
key
)

public Class<? extends PrivateKey>

Returns:

the private key class type associated with the security provider.
getEDDSAPrivateKeyType
()

public PublicKeyEntryDecoder<PUB, PRV>

Returns:

the public key entry decoder implementation associated with the security provider.
getEDDSAPublicKeyEntryDecoder
()

public Class<? extends PublicKey>

Returns:

the public key class type associated with the security provider.
getEDDSAPublicKeyType
()

public Signature

Returns:

the signature implementation associated with the security provider.
getEDDSASigner
()

public String

Returns:

the algorithm name used by the provider's java.security.KeyFactory.
getKeyFactoryAlgorithm
()

public PrivateKeyEntryDecoder<PUB, PRV>

Returns:

the private key entry decoder implementation associated with the security provider.
getOpenSSHEDDSAPrivateKeyEntryDecoder
()

public byte[]

Returns:

the raw private key bytes associated with the key
getPrivateKeyData
(PRV
the private key
privateKey
)

public byte[]

Returns:

the raw public key bytes associated with the key
getPublicKeyData
(PUB
the public key
publicKey
)

public <
type of the buffer
B extends Buffer
>
B

Returns:

the buffer that was passed in
putEDDSAKeyPair
(B
the buffer to insert the keys into
buffer
,
PublicKey
the public key to be inserted into the buffer
pubKey
,
PrivateKey
the private key to be inserted into the buffer
prvKey
)

public <
type of the buffer
B extends Buffer
>
B

Returns:

the buffer that was passed in
putRawEDDSAPublicKey
(B
the buffer to insert the public key into
buffer
,
PublicKey
the public key to be inserted into the buffer
key
)

public PUB

Returns:

the public key associated with the private key.
recoverEDDSAPublicKey
(PrivateKey
the private key
key
)

Field Detail

ED25519_OIDback to summary
public static final String ED25519_OID
See Also
RFC8412 section 3
KEY_SIZEback to summary
public static final int KEY_SIZE

Method Detail

compareEDDSAPPublicKeysback to summary
public boolean compareEDDSAPPublicKeys(PublicKey k1, PublicKey k2)
Parameters
k1:PublicKey

the first key

k2:PublicKey

the second key

Returns:boolean

true if both keys are instances of the public key type associated with the security provider and they are equal.

compareEDDSAPrivateKeysback to summary
public boolean compareEDDSAPrivateKeys(PrivateKey k1, PrivateKey k2)
Parameters
k1:PrivateKey

the first key

k2:PrivateKey

the second key

Returns:boolean

true if both keys are instances of the private key type associated with the security provider and they are equal.

createPrivateKeySpecback to summary
public KeySpec createPrivateKeySpec(PRV privateKey)
Parameters
privateKey:PRV

the private key

Returns:KeySpec

a key spec from the private key

createPublicKeySpecback to summary
public KeySpec createPublicKeySpec(PUB publicKey)
Parameters
publicKey:PUB

the public key

Returns:KeySpec

a key spec from the public key

decodeEd25519KeyPairback to summary
public static KeyPair decodeEd25519KeyPair(byte[] keyData) throws IOException, GeneralSecurityException
Parameters
keyData:byte[]

the raw private key bytes.

Returns:KeyPair

a KeyPair from the given raw private key data.

decodeEdDSAPrivateKeyback to summary
public static PrivateKey decodeEdDSAPrivateKey(byte[] keyData) throws IOException, GeneralSecurityException
Parameters
keyData:byte[]

the raw private key bytes.

Returns:PrivateKey

the associated private key.

generateEDDSAPrivateKeyback to summary
public PRV generateEDDSAPrivateKey(byte[] seed) throws GeneralSecurityException, IOException
Parameters
seed:byte[]

the raw private key bytes

Returns:PRV

the associated private key

generateEDDSAPublicKeyback to summary
public PUB generateEDDSAPublicKey(byte[] seed) throws GeneralSecurityException
Parameters
seed:byte[]

the raw public key bytes

Returns:PUB

the associated public key

getEDDSAKeySizeback to summary
public int getEDDSAKeySize(Key key)
Parameters
key:Key

the key to get the size of.

Returns:int

the size of the key if it is an EdDSA key, -1 otherwise.

getEDDSAPrivateKeyTypeback to summary
public Class<? extends PrivateKey> getEDDSAPrivateKeyType()
Returns:Class<? extends PrivateKey>

the private key class type associated with the security provider.

getEDDSAPublicKeyEntryDecoderback to summary
public PublicKeyEntryDecoder<PUB, PRV> getEDDSAPublicKeyEntryDecoder()
Returns:PublicKeyEntryDecoder<PUB, PRV>

the public key entry decoder implementation associated with the security provider.

getEDDSAPublicKeyTypeback to summary
public Class<? extends PublicKey> getEDDSAPublicKeyType()
Returns:Class<? extends PublicKey>

the public key class type associated with the security provider.

getEDDSASignerback to summary
public Signature getEDDSASigner()
Returns:Signature

the signature implementation associated with the security provider.

getKeyFactoryAlgorithmback to summary
public String getKeyFactoryAlgorithm()
Returns:String

the algorithm name used by the provider's java.security.KeyFactory.

getOpenSSHEDDSAPrivateKeyEntryDecoderback to summary
public PrivateKeyEntryDecoder<PUB, PRV> getOpenSSHEDDSAPrivateKeyEntryDecoder()
Returns:PrivateKeyEntryDecoder<PUB, PRV>

the private key entry decoder implementation associated with the security provider.

getPrivateKeyDataback to summary
public byte[] getPrivateKeyData(PRV privateKey) throws IOException
Parameters
privateKey:PRV

the private key

Returns:byte[]

the raw private key bytes associated with the key

getPublicKeyDataback to summary
public byte[] getPublicKeyData(PUB publicKey)
Parameters
publicKey:PUB

the public key

Returns:byte[]

the raw public key bytes associated with the key

putEDDSAKeyPairback to summary
public <B extends Buffer> B putEDDSAKeyPair(B buffer, PublicKey pubKey, PrivateKey prvKey)
Parameters
<B>
type of the buffer
buffer:B

the buffer to insert the keys into

pubKey:PublicKey

the public key to be inserted into the buffer

prvKey:PrivateKey

the private key to be inserted into the buffer

Returns:B

the buffer that was passed in

putRawEDDSAPublicKeyback to summary
public <B extends Buffer> B putRawEDDSAPublicKey(B buffer, PublicKey key)
Parameters
<B>
type of the buffer
buffer:B

the buffer to insert the public key into

key:PublicKey

the public key to be inserted into the buffer

Returns:B

the buffer that was passed in

recoverEDDSAPublicKeyback to summary
public PUB recoverEDDSAPublicKey(PrivateKey key) throws GeneralSecurityException
Parameters
key:PrivateKey

the private key

Returns:PUB

the public key associated with the private key.