Interface EdDSASupport<PUB extends java.security.PublicKey,PRV extends java.security.PrivateKey>
-
- Type Parameters:
PUB- type of the public key supported by the security providerPRV- type of the private key supported by the security provider
- All Known Implementing Classes:
BouncyCastleEdDSASupport,NetI2pCryptoEdDSASupport
public interface EdDSASupport<PUB extends java.security.PublicKey,PRV extends java.security.PrivateKey>Provides generic operations required of a security provider to support EdDSA and Ed25519.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringED25519_OIDstatic intKEY_SIZE
-
Method Summary
All Methods Static Methods Instance Methods Abstract 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(PRV privateKey)java.security.spec.KeySpeccreatePublicKeySpec(PUB publicKey)static java.security.KeyPairdecodeEd25519KeyPair(byte[] keyData)static java.security.PrivateKeydecodeEdDSAPrivateKey(byte[] keyData)PRVgenerateEDDSAPrivateKey(byte[] seed)PUBgenerateEDDSAPublicKey(byte[] seed)intgetEDDSAKeySize(java.security.Key key)java.lang.Class<PRV>getEDDSAPrivateKeyType()PublicKeyEntryDecoder<PUB,PRV>getEDDSAPublicKeyEntryDecoder()java.lang.Class<PUB>getEDDSAPublicKeyType()SignaturegetEDDSASigner()java.lang.StringgetKeyFactoryAlgorithm()PrivateKeyEntryDecoder<PUB,PRV>getOpenSSHEDDSAPrivateKeyEntryDecoder()byte[]getPrivateKeyData(PRV privateKey)byte[]getPublicKeyData(PUB 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)PUBrecoverEDDSAPublicKey(java.security.PrivateKey key)
-
-
-
Field Detail
-
KEY_SIZE
static final int KEY_SIZE
- See Also:
- Constant Field Values
-
ED25519_OID
static final java.lang.String ED25519_OID
- See Also:
- RFC8412 section 3, Constant Field Values
-
-
Method Detail
-
decodeEd25519KeyPair
static java.security.KeyPair decodeEd25519KeyPair(byte[] keyData) throws java.io.IOException, java.security.GeneralSecurityException- Parameters:
keyData- the raw private key bytes.- Returns:
- a
KeyPairfrom the given raw private key data. - Throws:
java.io.IOExceptionjava.security.GeneralSecurityException
-
decodeEdDSAPrivateKey
static java.security.PrivateKey decodeEdDSAPrivateKey(byte[] keyData) throws java.io.IOException, java.security.GeneralSecurityException- Parameters:
keyData- the raw private key bytes.- Returns:
- the associated private key.
- Throws:
java.io.IOExceptionjava.security.GeneralSecurityException
-
getEDDSAPublicKeyEntryDecoder
PublicKeyEntryDecoder<PUB,PRV> getEDDSAPublicKeyEntryDecoder()
- Returns:
- the public key entry decoder implementation associated with the security provider.
-
getOpenSSHEDDSAPrivateKeyEntryDecoder
PrivateKeyEntryDecoder<PUB,PRV> getOpenSSHEDDSAPrivateKeyEntryDecoder()
- Returns:
- the private key entry decoder implementation associated with the security provider.
-
getEDDSASigner
Signature getEDDSASigner()
- Returns:
- the signature implementation associated with the security provider.
-
getEDDSAKeySize
int getEDDSAKeySize(java.security.Key key)
- Parameters:
key- the key to get the size of.- Returns:
- the size of the key if it is an EdDSA key, -1 otherwise.
-
getEDDSAPublicKeyType
java.lang.Class<PUB> getEDDSAPublicKeyType()
- Returns:
- the public key class type associated with the security provider.
-
getEDDSAPrivateKeyType
java.lang.Class<PRV> getEDDSAPrivateKeyType()
- Returns:
- the private key class type associated with the security provider.
-
compareEDDSAPPublicKeys
boolean compareEDDSAPPublicKeys(java.security.PublicKey k1, java.security.PublicKey k2)- 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
boolean compareEDDSAPrivateKeys(java.security.PrivateKey k1, java.security.PrivateKey k2)- 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
PUB recoverEDDSAPublicKey(java.security.PrivateKey key) throws java.security.GeneralSecurityException
- Parameters:
key- the private key- Returns:
- the public key associated with the private key.
- Throws:
java.security.GeneralSecurityException
-
generateEDDSAPublicKey
PUB generateEDDSAPublicKey(byte[] seed) throws java.security.GeneralSecurityException
- Parameters:
seed- the raw public key bytes- Returns:
- the associated public key
- Throws:
java.security.GeneralSecurityException
-
generateEDDSAPrivateKey
PRV generateEDDSAPrivateKey(byte[] seed) throws java.security.GeneralSecurityException, java.io.IOException
- Parameters:
seed- the raw private key bytes- Returns:
- the associated private key
- Throws:
java.security.GeneralSecurityExceptionjava.io.IOException
-
putRawEDDSAPublicKey
<B extends Buffer> B putRawEDDSAPublicKey(B buffer, java.security.PublicKey key)
- 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
<B extends Buffer> B putEDDSAKeyPair(B buffer, java.security.PublicKey pubKey, java.security.PrivateKey prvKey)
- 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
java.security.spec.KeySpec createPublicKeySpec(PUB publicKey)
- Parameters:
publicKey- the public key- Returns:
- a key spec from the public key
-
createPrivateKeySpec
java.security.spec.KeySpec createPrivateKeySpec(PRV privateKey)
- Parameters:
privateKey- the private key- Returns:
- a key spec from the private key
-
getPublicKeyData
byte[] getPublicKeyData(PUB publicKey)
- Parameters:
publicKey- the public key- Returns:
- the raw public key bytes associated with the key
-
getPrivateKeyData
byte[] getPrivateKeyData(PRV privateKey) throws java.io.IOException
- Parameters:
privateKey- the private key- Returns:
- the raw private key bytes associated with the key
- Throws:
java.io.IOException
-
getKeyFactoryAlgorithm
java.lang.String getKeyFactoryAlgorithm()
- Returns:
- the algorithm name used by the provider's
KeyFactory.
-
-