public final class AsymmetricCryptoAlgorithmBuilder extends Object
AsymmetricCryptoAlgorithm.AsymmetricCryptoAlgorithm| Constructor and Description |
|---|
AsymmetricCryptoAlgorithmBuilder(String algorithmName)
Creates a new builder.
|
| Modifier and Type | Method and Description |
|---|---|
EncryptionAlgorithm |
build()
Builds a new instance of encryption algorithm.
|
AsymmetricCryptoAlgorithmBuilder |
bytesRepresentation(BytesRepresentation bytesRepresentation)
Sets how byte arrays will be represented in strings.
|
AsymmetricCryptoAlgorithmBuilder |
encoding(String encoding)
Sets encoding for strings in input and output.
|
AsymmetricCryptoAlgorithmBuilder |
keyPair(KeyPair keyPair)
Sets both public and private key for both encryption and decryption.
|
AsymmetricCryptoAlgorithmBuilder |
privateKey(BigInteger modulus,
BigInteger exponent)
Sets private key for decryption of messages.
|
AsymmetricCryptoAlgorithmBuilder |
privateKey(KeyFactory<Key> privateKeyFactory)
Sets custom factory of private key for decryption of messages.
|
AsymmetricCryptoAlgorithmBuilder |
publicKey(BigInteger modulus,
BigInteger exponent)
Sets public key for encryption of messages.
|
AsymmetricCryptoAlgorithmBuilder |
publicKey(KeyFactory<Key> publicKeyFactory)
Sets custom factory of public key for encryption of messages.
|
public AsymmetricCryptoAlgorithmBuilder(String algorithmName)
algorithmName - full algorithm name (used for Cipher initialization)public AsymmetricCryptoAlgorithmBuilder publicKey(BigInteger modulus, BigInteger exponent)
modulus - modulus of keyexponent - exponent of public keypublic AsymmetricCryptoAlgorithmBuilder publicKey(KeyFactory<Key> publicKeyFactory)
publicKeyFactory - factory of public keypublic AsymmetricCryptoAlgorithmBuilder privateKey(BigInteger modulus, BigInteger exponent)
modulus - modulus of keyexponent - exponent of private keyIllegalArgumentException - exception if passed modulus or exponent is nullpublic AsymmetricCryptoAlgorithmBuilder privateKey(KeyFactory<Key> privateKeyFactory)
privateKeyFactory - factory of private keyIllegalArgumentException - exception if passed factory is nullpublic AsymmetricCryptoAlgorithmBuilder keyPair(KeyPair keyPair)
keyPair - key pairIllegalArgumentException - exception if passed key pair is nullpublic AsymmetricCryptoAlgorithmBuilder bytesRepresentation(BytesRepresentation bytesRepresentation)
HexRepresentation is used.bytesRepresentation - byte array representation strategyIllegalArgumentException - exception if passed BytesRepresentation is nullpublic AsymmetricCryptoAlgorithmBuilder encoding(String encoding)
encoding - encoding to be setIllegalArgumentException - exception if given encoding is null or not supportedpublic EncryptionAlgorithm build() throws IllegalArgumentException
EncryptionException - possible exception when encryption algorithm cannot be builtIllegalArgumentExceptionCopyright © 2016. All rights reserved.