Package org.bouncycastle.jcajce.spec
Class KTSGenerateKeySpec.Builder
java.lang.Object
org.bouncycastle.jcajce.spec.KTSGenerateKeySpec.Builder
- Enclosing class:
- KTSGenerateKeySpec
Builder class for creating a KTSGenerateKeySpec.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the new key spec.withKdfAlgorithm
(AlgorithmIdentifier kdfAlgorithm) Set the KDF algorithm and digest algorithm for key generation.Set the KDF algorithm and digest algorithm for key generation.withKdfSalt
(byte[] salt) Set the KDF salt for key generation (ignored for OAEP).Set the MAC algorithm name and its associated key size for the MAC key section of the secret.withParameterSpec
(AlgorithmParameterSpec parameterSpec) Set the algorithm parameter spec to be used with the public key.withSecureRandom
(SecureRandom random) Set the SecureRandom which will be used to generate the secret.
-
Constructor Details
-
Builder
Basic builder.- Parameters:
publicKey
- the public key to be used for encryption/encapsulation generation.algorithmName
- the algorithm name for the secret key we wish to calculate.keySizeInBits
- the size of the key we want to produce in bits.
-
Builder
Basic builder.- Parameters:
publicKey
- the public key to be used for encryption/encapsulation generation.algorithmName
- the algorithm name for the secret key we wish to calculate.keySizeInBits
- the size of the key we want to produce in bits.otherInfo
- the otherInfo/IV encoding to be applied to the KDF.
-
-
Method Details
-
withSecureRandom
Set the SecureRandom which will be used to generate the secret.- Parameters:
random
- the source of randomness for the secret.- Returns:
- the current Builder instance.
-
withMac
Set the MAC algorithm name and its associated key size for the MAC key section of the secret.- Parameters:
macAlgorithmName
- name of the MAC algorithm we will use.macKeySizeInBits
- size of the MAC key (in bits)- Returns:
- the current Builder instance.
-
withParameterSpec
Set the algorithm parameter spec to be used with the public key.- Parameters:
parameterSpec
- the algorithm parameter spec to be used in encryption.- Returns:
- the current Builder instance.
-
withKdfAlgorithm
public KTSGenerateKeySpec.Builder withKdfAlgorithm(FipsKDF.AgreementKDFParametersBuilder kdfBuilder) Set the KDF algorithm and digest algorithm for key generation.- Parameters:
kdfBuilder
- the KDF algorithm to apply.- Returns:
- the current Builder instance.
-
withKdfAlgorithm
Set the KDF algorithm and digest algorithm for key generation.- Parameters:
kdfAlgorithm
- the KDF algorithm to apply.- Returns:
- the current Builder instance.
-
withKdfSalt
Set the KDF salt for key generation (ignored for OAEP).- Parameters:
salt
- the salt for initialising the KDF PRF.- Returns:
- the current Builder instance.
-
build
Build the new key spec.- Returns:
- a new key spec configured according to the builder state.
-