Class NetI2pCryptoEdDSASupport
- java.lang.Object
-
- org.apache.sshd.common.util.security.eddsa.NetI2pCryptoEdDSASupport
-
- All Implemented Interfaces:
EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>
public class NetI2pCryptoEdDSASupport extends java.lang.Object implements EdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>
-
-
Field Summary
-
Fields inherited from interface org.apache.sshd.common.util.security.eddsa.generic.EdDSASupport
ED25519_OID, KEY_SIZE
-
-
Constructor Summary
Constructors Constructor Description NetI2pCryptoEdDSASupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompareEDDSAPPublicKeys(java.security.PublicKey k1, java.security.PublicKey k2)booleancompareEDDSAPrivateKeys(java.security.PrivateKey k1, java.security.PrivateKey k2)java.security.spec.KeySpeccreatePrivateKeySpec(net.i2p.crypto.eddsa.EdDSAPrivateKey privateKey)java.security.spec.KeySpeccreatePublicKeySpec(net.i2p.crypto.eddsa.EdDSAPublicKey publicKey)net.i2p.crypto.eddsa.EdDSAPrivateKeygenerateEDDSAPrivateKey(byte[] seed)net.i2p.crypto.eddsa.EdDSAPublicKeygenerateEDDSAPublicKey(byte[] seed)intgetEDDSAKeySize(java.security.Key key)java.lang.Class<net.i2p.crypto.eddsa.EdDSAPrivateKey>getEDDSAPrivateKeyType()PublicKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>getEDDSAPublicKeyEntryDecoder()java.lang.Class<net.i2p.crypto.eddsa.EdDSAPublicKey>getEDDSAPublicKeyType()SignaturegetEDDSASigner()java.lang.StringgetKeyFactoryAlgorithm()PrivateKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>getOpenSSHEDDSAPrivateKeyEntryDecoder()byte[]getPrivateKeyData(net.i2p.crypto.eddsa.EdDSAPrivateKey privateKey)byte[]getPublicKeyData(net.i2p.crypto.eddsa.EdDSAPublicKey publicKey)<B extends Buffer>
BputEDDSAKeyPair(B buffer, java.security.PublicKey pubKey, java.security.PrivateKey prvKey)<B extends Buffer>
BputRawEDDSAPublicKey(B buffer, java.security.PublicKey key)net.i2p.crypto.eddsa.EdDSAPublicKeyrecoverEDDSAPublicKey(java.security.PrivateKey key)
-
-
-
Method Detail
-
getEDDSAPublicKeyEntryDecoder
public PublicKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey> getEDDSAPublicKeyEntryDecoder()
- Specified by:
getEDDSAPublicKeyEntryDecoderin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Returns:
- the public key entry decoder implementation associated with the security provider.
-
getOpenSSHEDDSAPrivateKeyEntryDecoder
public PrivateKeyEntryDecoder<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey> getOpenSSHEDDSAPrivateKeyEntryDecoder()
- Specified by:
getOpenSSHEDDSAPrivateKeyEntryDecoderin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Returns:
- the private key entry decoder implementation associated with the security provider.
-
getEDDSASigner
public Signature getEDDSASigner()
- Specified by:
getEDDSASignerin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Returns:
- the signature implementation associated with the security provider.
-
getEDDSAKeySize
public int getEDDSAKeySize(java.security.Key key)
- Specified by:
getEDDSAKeySizein interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
key- the key to get the size of.- Returns:
- the size of the key if it is an EdDSA key, -1 otherwise.
-
getEDDSAPublicKeyType
public java.lang.Class<net.i2p.crypto.eddsa.EdDSAPublicKey> getEDDSAPublicKeyType()
- Specified by:
getEDDSAPublicKeyTypein interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Returns:
- the public key class type associated with the security provider.
-
getEDDSAPrivateKeyType
public java.lang.Class<net.i2p.crypto.eddsa.EdDSAPrivateKey> getEDDSAPrivateKeyType()
- Specified by:
getEDDSAPrivateKeyTypein interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Returns:
- the private key class type associated with the security provider.
-
compareEDDSAPPublicKeys
public boolean compareEDDSAPPublicKeys(java.security.PublicKey k1, java.security.PublicKey k2)- Specified by:
compareEDDSAPPublicKeysin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
k1- the first keyk2- the second key- Returns:
trueif both keys are instances of the public key type associated with the security provider and they are equal.
-
compareEDDSAPrivateKeys
public boolean compareEDDSAPrivateKeys(java.security.PrivateKey k1, java.security.PrivateKey k2)- Specified by:
compareEDDSAPrivateKeysin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
k1- the first keyk2- the second key- Returns:
trueif both keys are instances of the private key type associated with the security provider and they are equal.
-
recoverEDDSAPublicKey
public net.i2p.crypto.eddsa.EdDSAPublicKey recoverEDDSAPublicKey(java.security.PrivateKey key) throws java.security.GeneralSecurityException- Specified by:
recoverEDDSAPublicKeyin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
key- the private key- Returns:
- the public key associated with the private key.
- Throws:
java.security.GeneralSecurityException
-
generateEDDSAPublicKey
public net.i2p.crypto.eddsa.EdDSAPublicKey generateEDDSAPublicKey(byte[] seed) throws java.security.GeneralSecurityException- Specified by:
generateEDDSAPublicKeyin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
seed- the raw public key bytes- Returns:
- the associated public key
- Throws:
java.security.GeneralSecurityException
-
generateEDDSAPrivateKey
public net.i2p.crypto.eddsa.EdDSAPrivateKey generateEDDSAPrivateKey(byte[] seed) throws java.security.GeneralSecurityException- Specified by:
generateEDDSAPrivateKeyin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
seed- the raw private key bytes- Returns:
- the associated private key
- Throws:
java.security.GeneralSecurityException
-
putRawEDDSAPublicKey
public <B extends Buffer> B putRawEDDSAPublicKey(B buffer, java.security.PublicKey key)
- Specified by:
putRawEDDSAPublicKeyin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Type Parameters:
B- type of the buffer- Parameters:
buffer- the buffer to insert the public key intokey- the public key to be inserted into the buffer- Returns:
- the buffer that was passed in
-
putEDDSAKeyPair
public <B extends Buffer> B putEDDSAKeyPair(B buffer, java.security.PublicKey pubKey, java.security.PrivateKey prvKey)
- Specified by:
putEDDSAKeyPairin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Type Parameters:
B- type of the buffer- Parameters:
buffer- the buffer to insert the keys intopubKey- the public key to be inserted into the bufferprvKey- the private key to be inserted into the buffer- Returns:
- the buffer that was passed in
-
createPublicKeySpec
public java.security.spec.KeySpec createPublicKeySpec(net.i2p.crypto.eddsa.EdDSAPublicKey publicKey)
- Specified by:
createPublicKeySpecin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
publicKey- the public key- Returns:
- a key spec from the public key
-
createPrivateKeySpec
public java.security.spec.KeySpec createPrivateKeySpec(net.i2p.crypto.eddsa.EdDSAPrivateKey privateKey)
- Specified by:
createPrivateKeySpecin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
privateKey- the private key- Returns:
- a key spec from the private key
-
getPublicKeyData
public byte[] getPublicKeyData(net.i2p.crypto.eddsa.EdDSAPublicKey publicKey)
- Specified by:
getPublicKeyDatain interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
publicKey- the public key- Returns:
- the raw public key bytes associated with the key
-
getPrivateKeyData
public byte[] getPrivateKeyData(net.i2p.crypto.eddsa.EdDSAPrivateKey privateKey) throws java.io.IOException- Specified by:
getPrivateKeyDatain interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Parameters:
privateKey- the private key- Returns:
- the raw private key bytes associated with the key
- Throws:
java.io.IOException
-
getKeyFactoryAlgorithm
public java.lang.String getKeyFactoryAlgorithm()
- Specified by:
getKeyFactoryAlgorithmin interfaceEdDSASupport<net.i2p.crypto.eddsa.EdDSAPublicKey,net.i2p.crypto.eddsa.EdDSAPrivateKey>- Returns:
- the algorithm name used by the provider's
KeyFactory.
-
-