Module io.github.mmm.crypto
Class AsymmetricKeyCreatorImpl<PR extends PrivateKey,PU extends PublicKey,PAIR extends AbstractAsymmetricKeyPair<PR,PU>>
- java.lang.Object
-
- io.github.mmm.crypto.algorithm.AbstractSecurityAlgorithm
-
- io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
-
- io.github.mmm.crypto.algorithm.CryptoAlgorithmImpl
-
- io.github.mmm.crypto.algorithm.CryptoAlgorithmImplWithRandom
-
- io.github.mmm.crypto.asymmetric.key.AbstractAsymmetricKeyCreator<PR,PU,PAIR>
-
- io.github.mmm.crypto.asymmetric.key.generic.AsymmetricKeyCreatorImpl<PR,PU,PAIR>
-
- Type Parameters:
PR- type ofPrivateKey.PU- type ofPublicKey.PAIR- type ofAsymmetricKeyPair.
- All Implemented Interfaces:
CryptoAlgorithm,AsymmetricKeyCreator<PR,PU,PAIR>,AsymmetricKeyPairFactory<PR,PU,PAIR>,AsymmetricKeyPairFactorySimple<PR,PU,PAIR>,PrivateKeyFactory<PR>,PublicKeyFactory<PU>,KeyCreator
public class AsymmetricKeyCreatorImpl<PR extends PrivateKey,PU extends PublicKey,PAIR extends AbstractAsymmetricKeyPair<PR,PU>> extends AbstractAsymmetricKeyCreator<PR,PU,PAIR>
Generic implementation ofKeyCreator. If available you should prefer implementations for specific algorithms accordingSecurityAccess*classes (e.g.Rsa).- Since:
- 1.0.0
-
-
Field Summary
-
Fields inherited from class io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
provider
-
-
Constructor Summary
Constructors Constructor Description AsymmetricKeyCreatorImpl(KeyFactory keyFactory, int keyLength, SecurityProvider provider, AsymmetricKeyPairFactorySimple<PR,PU,PAIR> keyPairFactory, RandomFactory randomFactory)The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PAIRcreateKeyPair(PR privateKey, PU publicKey)intgetKeyLength(PR privateKey)intgetKeyLength(PU publicKey)static AsymmetricKeyCreator<PrivateKey,PublicKey,AsymmetricKeyPairGeneric>of(String algorithm, int keyLength)static AsymmetricKeyCreator<PrivateKey,PublicKey,AsymmetricKeyPairGeneric>of(String algorithm, int keyLength, SecurityProvider provider, RandomFactory randomFactory)static AsymmetricKeyCreator<PrivateKey,PublicKey,AsymmetricKeyPairGeneric>of(String algorithm, int keyLength, RandomFactory randomFactory)-
Methods inherited from class io.github.mmm.crypto.asymmetric.key.AbstractAsymmetricKeyCreator
asData, asData, asData, createKeyPair, createPrivateKey, createPublicKey, generateKeyPair, getKeyLength, init, register, register
-
Methods inherited from class io.github.mmm.crypto.algorithm.CryptoAlgorithmImplWithRandom
createSecureRandom, getRandomFactory
-
Methods inherited from class io.github.mmm.crypto.algorithm.CryptoAlgorithmImpl
getAlgorithm
-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
getProvider
-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractSecurityAlgorithm
creationFailedException, creationFailedException, creationFailedException, creationFailedException, getAlgorithm, 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.AsymmetricKeyCreator
asBinary, asBinary, asBinary, asData, asData, asData, createKeyPair, createPrivateKey, createPublicKey, verifyKey, verifyKey
-
Methods inherited from interface io.github.mmm.crypto.asymmetric.key.AsymmetricKeyPairFactory
asBinary
-
Methods inherited from interface io.github.mmm.crypto.algorithm.CryptoAlgorithm
getAlgorithm
-
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
-
AsymmetricKeyCreatorImpl
public AsymmetricKeyCreatorImpl(KeyFactory keyFactory, int keyLength, SecurityProvider provider, AsymmetricKeyPairFactorySimple<PR,PU,PAIR> keyPairFactory, RandomFactory randomFactory)
The constructor.- Parameters:
keyFactory- theKeyFactory.keyLength- thekey length.provider- the securitySecurityProvider.keyPairFactory- theAsymmetricKeyPairFactorySimple.randomFactory- theRandomFactory.
-
-
Method Detail
-
createKeyPair
public PAIR createKeyPair(PR privateKey, PU publicKey)
- Parameters:
privateKey- thePrivateKey.publicKey- the correspondingPublicKey.- Returns:
- the
AsymmetricKeyPair.
-
getKeyLength
public int getKeyLength(PR privateKey)
- Parameters:
privateKey- thePrivateKey.- Returns:
- the
key lengthof the given key in bits.
-
getKeyLength
public int getKeyLength(PU publicKey)
- Parameters:
publicKey- thePublicKey.- Returns:
- the
key lengthof the given key in bits.
-
of
public static AsymmetricKeyCreator<PrivateKey,PublicKey,AsymmetricKeyPairGeneric> of(String algorithm, int keyLength)
- Parameters:
algorithm- thealgorithm.keyLength- thekey length.- Returns:
- the
AsymmetricKeyCreator.
-
of
public static AsymmetricKeyCreator<PrivateKey,PublicKey,AsymmetricKeyPairGeneric> of(String algorithm, int keyLength, RandomFactory randomFactory)
- Parameters:
algorithm- thealgorithm.keyLength- thekey length.randomFactory- theRandomFactory.- Returns:
- the
AsymmetricKeyCreator.
-
of
public static AsymmetricKeyCreator<PrivateKey,PublicKey,AsymmetricKeyPairGeneric> of(String algorithm, int keyLength, SecurityProvider provider, RandomFactory randomFactory)
- Parameters:
algorithm- thealgorithm.keyLength- thekey length.provider- theSecurityProvider.randomFactory- theRandomFactory.- Returns:
- the
AsymmetricKeyCreator.
-
-