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>
ExtendsKeyCreator
for 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 Binary
asBinary(PAIR keyPair, String format)
default Binary
asBinary(PR privateKey, String format)
default Binary
asBinary(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 PAIR
createKeyPair(byte[] data)
PAIR
createKeyPair(byte[] data, String format)
default PR
createPrivateKey(byte[] data)
PR
createPrivateKey(byte[] data, String format)
default PU
createPublicKey(byte[] data)
PU
createPublicKey(byte[] data, String format)
PAIR
generateKeyPair()
int
getKeyLength(PR privateKey)
int
getKeyLength(PU publicKey)
default void
verifyKey(PR privateKey)
Verify that the given key matches the criteria of this key creator such askey length
.default void
verifyKey(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
AsymmetricKeyPair
with a generatedprivate
andpublic
key for the underlying cryptography.
-
asData
default byte[] asData(PR privateKey)
- Specified by:
asData
in interfacePrivateKeyFactory<PR extends PrivateKey>
- Parameters:
privateKey
- thePrivateKey
to serialize.- Returns:
- the serialized binary data.
-
asBinary
default Binary asBinary(PR privateKey, String format)
- Parameters:
privateKey
- thePrivateKey
to serialize.format
- the theCryptoBinaryFormat
to use.- Returns:
- the
Binary
.
-
asData
byte[] asData(PR privateKey, String format)
- Parameters:
privateKey
- thePrivateKey
to serialize.format
- the theCryptoBinaryFormat
to use.- Returns:
- the binary data.
-
createPrivateKey
default PR createPrivateKey(byte[] data)
- Specified by:
createPrivateKey
in interfacePrivateKeyFactory<PR extends PrivateKey>
- Parameters:
data
- thePrivateKey
as rawbyte
array.- Returns:
- the deserialized
PrivateKey
.
-
createPrivateKey
PR createPrivateKey(byte[] data, String format)
- Parameters:
data
- thePrivateKey
as rawbyte
array.format
- theCryptoBinaryFormat
to use.- Returns:
- the deserialized
PrivateKey
.
-
asData
default byte[] asData(PU publicKey)
- Specified by:
asData
in interfacePublicKeyFactory<PR extends PrivateKey>
- Parameters:
publicKey
- thePublicKey
to serialize.- Returns:
- the serialized binary data.
-
asBinary
default Binary asBinary(PU publicKey, String format)
- Parameters:
publicKey
- thePublicKey
to serialize.format
- the theCryptoBinaryFormat
to use.- Returns:
- the
Binary
.
-
asData
byte[] asData(PU publicKey, String format)
- Parameters:
publicKey
- thePublicKey
to serialize.format
- the theCryptoBinaryFormat
to use.- Returns:
- the binary data.
-
createPublicKey
default PU createPublicKey(byte[] data)
- Specified by:
createPublicKey
in interfacePublicKeyFactory<PR extends PrivateKey>
- Parameters:
data
- thePublicKey
as rawbyte
array.- Returns:
- the deserialized
PublicKey
.
-
createPublicKey
PU createPublicKey(byte[] data, String format)
- Parameters:
data
- thePublicKey
as rawbyte
array.format
- the theCryptoBinaryFormat
to use.- Returns:
- the deserialized
PublicKey
.
-
asData
default byte[] asData(PAIR keyPair)
- Specified by:
asData
in interfaceAsymmetricKeyPairFactory<PR extends PrivateKey,PU extends PublicKey,PAIR extends AsymmetricKeyPair<PR,PU>>
- Parameters:
keyPair
- theAsymmetricKeyPair
to serialize.- Returns:
- the serialized binary data.
-
asBinary
default Binary asBinary(PAIR keyPair, String format)
- Parameters:
keyPair
- theAsymmetricKeyPair
to serialize.format
- the theCryptoBinaryFormat
to use.- Returns:
- the serialized
Binary
.
-
asData
byte[] asData(PAIR keyPair, String format)
- Parameters:
keyPair
- theAsymmetricKeyPair
to serialize.format
- the theCryptoBinaryFormat
to use.- Returns:
- the serialized binary data.
-
createKeyPair
default PAIR createKeyPair(byte[] data)
- Specified by:
createKeyPair
in interfaceAsymmetricKeyPairFactory<PR extends PrivateKey,PU extends PublicKey,PAIR extends AsymmetricKeyPair<PR,PU>>
- Parameters:
data
- theAsymmetricKeyPair
in its binary form.- Returns:
- the deserialized
AsymmetricKeyPair
.
-
createKeyPair
PAIR createKeyPair(byte[] data, String format)
- Parameters:
data
- theAsymmetricKeyPair
as raw byte array.format
- the theCryptoBinaryFormat
to use.- Returns:
- the deserialized
AsymmetricKeyPair
.
-
getKeyLength
int getKeyLength(PR privateKey)
- Parameters:
privateKey
- thePrivateKey
.- Returns:
- the
key length
of 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
- thePrivateKey
to verify.
-
getKeyLength
int getKeyLength(PU publicKey)
- Parameters:
publicKey
- thePublicKey
.- Returns:
- the
key length
of 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
- thePublicKey
to verify.
-
-