Module io.github.mmm.crypto
Class AsymmetricKeyPairFactoryEncoded<PR extends PrivateKey,PU extends PublicKey,PAIR extends AbstractAsymmetricKeyPair<PR,PU>>
- java.lang.Object
-
- io.github.mmm.crypto.asymmetric.key.AbstractAsymmetricKeyPairFactory<PR,PU,PAIR>
-
- io.github.mmm.crypto.asymmetric.key.generic.AsymmetricKeyPairFactoryEncoded<PR,PU,PAIR>
-
- Type Parameters:
PR
- type ofPrivateKey
.PU
- type ofPublicKey
.PAIR
- type ofAsymmetricKeyPair
.
- All Implemented Interfaces:
AsymmetricKeyPairFactory<PR,PU,PAIR>
,AsymmetricKeyPairFactorySimple<PR,PU,PAIR>
,PrivateKeyFactory<PR>
,PublicKeyFactory<PU>
public class AsymmetricKeyPairFactoryEncoded<PR extends PrivateKey,PU extends PublicKey,PAIR extends AbstractAsymmetricKeyPair<PR,PU>> extends AbstractAsymmetricKeyPairFactory<PR,PU,PAIR>
Implementation ofAsymmetricKeyPairFactory
forencoded format
based onPKCS8EncodedKeySpec
andX509EncodedKeySpec
.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description AsymmetricKeyPairFactoryEncoded(KeyFactory keyFactory, AsymmetricKeyPairFactorySimple<PR,PU,PAIR> keyPairCreator)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
asData(PAIR keyPair)
byte[]
asData(PR privateKey)
byte[]
asData(PU publicKey)
PAIR
createKeyPair(byte[] data)
PAIR
createKeyPair(PR privateKey, PU publicKey)
PR
createPrivateKey(byte[] data)
PU
createPublicKey(byte[] data)
-
Methods inherited from class io.github.mmm.crypto.asymmetric.key.AbstractAsymmetricKeyPairFactory
createPrivateKey, createPublicKey, getKeyFactory, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.AsymmetricKeyPairFactory
asBinary
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.PrivateKeyFactory
asBinary
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.PublicKeyFactory
asBinary
-
-
-
-
Constructor Detail
-
AsymmetricKeyPairFactoryEncoded
public AsymmetricKeyPairFactoryEncoded(KeyFactory keyFactory, AsymmetricKeyPairFactorySimple<PR,PU,PAIR> keyPairCreator)
The constructor.- Parameters:
keyFactory
- theKeyFactory
.keyPairCreator
- theAsymmetricKeyPairFactorySimple
.
-
-
Method Detail
-
asData
public byte[] asData(PR privateKey)
- Parameters:
privateKey
- thePrivateKey
to serialize.- Returns:
- the serialized binary data.
-
createPrivateKey
public PR createPrivateKey(byte[] data)
- Parameters:
data
- thePrivateKey
as rawbyte
array.- Returns:
- the deserialized
PrivateKey
.
-
asData
public byte[] asData(PU publicKey)
- Parameters:
publicKey
- thePublicKey
to serialize.- Returns:
- the serialized binary data.
-
createPublicKey
public PU createPublicKey(byte[] data)
-
asData
public byte[] asData(PAIR keyPair)
- Parameters:
keyPair
- theAsymmetricKeyPair
to serialize.- Returns:
- the serialized binary data.
-
createKeyPair
public PAIR createKeyPair(PR privateKey, PU publicKey)
- Parameters:
privateKey
- thePrivateKey
.publicKey
- the correspondingPublicKey
.- Returns:
- the
AsymmetricKeyPair
.
-
createKeyPair
public PAIR createKeyPair(byte[] data)
- Parameters:
data
- theAsymmetricKeyPair
in its binary form.- Returns:
- the deserialized
AsymmetricKeyPair
.
-
-