Module io.github.mmm.crypto
Interface AsymmetricKeyCreator<PR extends PrivateKey,PU extends PublicKey,PAIR extends AsymmetricKeyPair<PR,PU>>
-
- Type Parameters:
PR- type ofPrivateKey.PU- type ofPublicKey.PAIR- type ofAsymmetricKeyPair.
- All Superinterfaces:
AsymmetricKeyPairFactory<PR,PU,PAIR>,AsymmetricKeyPairFactorySimple<PR,PU,PAIR>,CryptoAlgorithm,KeyCreator,PrivateKeyFactory<PR>,PublicKeyFactory<PU>
- All Known Implementing Classes:
AbstractAsymmetricKeyCreator,AsymmetricKeyCreatorEcBc,AsymmetricKeyCreatorImpl,AsymmetricKeyCreatorRsa
public interface AsymmetricKeyCreator<PR extends PrivateKey,PU extends PublicKey,PAIR extends AsymmetricKeyPair<PR,PU>> extends KeyCreator, AsymmetricKeyPairFactory<PR,PU,PAIR>
ExtendsKeyCreatorfor dealing with asymmetric cryptographic keys.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
- See Also:
generateKeyPair(),createPrivateKey(byte[], String),createPublicKey(byte[], String),createKeyPair(byte[], String)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default BinaryasBinary(PAIR keyPair, String format)default BinaryasBinary(PR privateKey, String format)default BinaryasBinary(PU publicKey, String format)default byte[]asData(PAIR keyPair)byte[]asData(PAIR keyPair, String format)default byte[]asData(PR privateKey)byte[]asData(PR privateKey, String format)default byte[]asData(PU publicKey)byte[]asData(PU publicKey, String format)default PAIRcreateKeyPair(byte[] data)PAIRcreateKeyPair(byte[] data, String format)default PRcreatePrivateKey(byte[] data)PRcreatePrivateKey(byte[] data, String format)default PUcreatePublicKey(byte[] data)PUcreatePublicKey(byte[] data, String format)PAIRgenerateKeyPair()intgetKeyLength(PR privateKey)intgetKeyLength(PU publicKey)default voidverifyKey(PR privateKey)Verify that the given key matches the criteria of this key creator such askey length.default voidverifyKey(PU publicKey)Verify that the given key matches the criteria of this key creator such askey length.-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.AsymmetricKeyPairFactory
asBinary
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.AsymmetricKeyPairFactorySimple
createKeyPair
-
Methods inherited from interface io.github.mmm.crypto.algorithm.CryptoAlgorithm
getAlgorithm
-
Methods inherited from interface io.github.mmm.crypto.key.KeyCreator
getKeyLength
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.PrivateKeyFactory
asBinary
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.PublicKeyFactory
asBinary
-
-
-
-
Method Detail
-
generateKeyPair
PAIR generateKeyPair()
- Returns:
- a new
AsymmetricKeyPairwith a generatedprivateandpublickey for the underlying cryptography.
-
asData
default byte[] asData(PR privateKey)
- Specified by:
asDatain interfacePrivateKeyFactory<PR extends PrivateKey>- Parameters:
privateKey- thePrivateKeyto serialize.- Returns:
- the serialized binary data.
-
asBinary
default Binary asBinary(PR privateKey, String format)
- Parameters:
privateKey- thePrivateKeyto serialize.format- the theCryptoBinaryFormatto use.- Returns:
- the
Binary.
-
asData
byte[] asData(PR privateKey, String format)
- Parameters:
privateKey- thePrivateKeyto serialize.format- the theCryptoBinaryFormatto use.- Returns:
- the binary data.
-
createPrivateKey
default PR createPrivateKey(byte[] data)
- Specified by:
createPrivateKeyin interfacePrivateKeyFactory<PR extends PrivateKey>- Parameters:
data- thePrivateKeyas rawbytearray.- Returns:
- the deserialized
PrivateKey.
-
createPrivateKey
PR createPrivateKey(byte[] data, String format)
- Parameters:
data- thePrivateKeyas rawbytearray.format- theCryptoBinaryFormatto use.- Returns:
- the deserialized
PrivateKey.
-
asData
default byte[] asData(PU publicKey)
- Specified by:
asDatain interfacePublicKeyFactory<PR extends PrivateKey>- Parameters:
publicKey- thePublicKeyto serialize.- Returns:
- the serialized binary data.
-
asBinary
default Binary asBinary(PU publicKey, String format)
- Parameters:
publicKey- thePublicKeyto serialize.format- the theCryptoBinaryFormatto use.- Returns:
- the
Binary.
-
asData
byte[] asData(PU publicKey, String format)
- Parameters:
publicKey- thePublicKeyto serialize.format- the theCryptoBinaryFormatto use.- Returns:
- the binary data.
-
createPublicKey
default PU createPublicKey(byte[] data)
- Specified by:
createPublicKeyin interfacePublicKeyFactory<PR extends PrivateKey>- Parameters:
data- thePublicKeyas rawbytearray.- Returns:
- the deserialized
PublicKey.
-
createPublicKey
PU createPublicKey(byte[] data, String format)
- Parameters:
data- thePublicKeyas rawbytearray.format- the theCryptoBinaryFormatto use.- Returns:
- the deserialized
PublicKey.
-
asData
default byte[] asData(PAIR keyPair)
- Specified by:
asDatain interfaceAsymmetricKeyPairFactory<PR extends PrivateKey,PU extends PublicKey,PAIR extends AsymmetricKeyPair<PR,PU>>- Parameters:
keyPair- theAsymmetricKeyPairto serialize.- Returns:
- the serialized binary data.
-
asBinary
default Binary asBinary(PAIR keyPair, String format)
- Parameters:
keyPair- theAsymmetricKeyPairto serialize.format- the theCryptoBinaryFormatto use.- Returns:
- the serialized
Binary.
-
asData
byte[] asData(PAIR keyPair, String format)
- Parameters:
keyPair- theAsymmetricKeyPairto serialize.format- the theCryptoBinaryFormatto use.- Returns:
- the serialized binary data.
-
createKeyPair
default PAIR createKeyPair(byte[] data)
- Specified by:
createKeyPairin interfaceAsymmetricKeyPairFactory<PR extends PrivateKey,PU extends PublicKey,PAIR extends AsymmetricKeyPair<PR,PU>>- Parameters:
data- theAsymmetricKeyPairin its binary form.- Returns:
- the deserialized
AsymmetricKeyPair.
-
createKeyPair
PAIR createKeyPair(byte[] data, String format)
- Parameters:
data- theAsymmetricKeyPairas raw byte array.format- the theCryptoBinaryFormatto use.- Returns:
- the deserialized
AsymmetricKeyPair.
-
getKeyLength
int getKeyLength(PR privateKey)
- Parameters:
privateKey- thePrivateKey.- Returns:
- the
key lengthof the given key in bits.
-
verifyKey
default void verifyKey(PR privateKey)
Verify that the given key matches the criteria of this key creator such askey length.- Parameters:
privateKey- thePrivateKeyto verify.
-
getKeyLength
int getKeyLength(PU publicKey)
- Parameters:
publicKey- thePublicKey.- Returns:
- the
key lengthof the given key in bits.
-
verifyKey
default void verifyKey(PU publicKey)
Verify that the given key matches the criteria of this key creator such askey length.- Parameters:
publicKey- thePublicKeyto verify.
-
-