Package org.bouncycastle.jcajce.spec
Class KTSExtractKeySpec.Builder
java.lang.Object
org.bouncycastle.jcajce.spec.KTSExtractKeySpec.Builder
- Enclosing class:
- KTSExtractKeySpec
Builder class for creating a KTSExtractKeySpec.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(PrivateKey privateKey, byte[] encapsulation, String algorithmName, int keySizeInBits) Basic builder.Builder
(PrivateKey privateKey, byte[] encapsulation, String algorithmName, int keySizeInBits, byte[] otherInfo) Basic builder. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the new key spec.withKdfAlgorithm
(AlgorithmIdentifier kdfAlgorithm) Set the KDF algorithm and digest algorithm for key generation (ignored for OAEP).withKdfAlgorithm
(FipsKDF.AgreementKDFParametersBuilder kdfAlgorithm) Set the KDF algorithm and digest algorithm for key generation (ignored for OAEP).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 in the encapsulation.withParameterSpec
(AlgorithmParameterSpec parameterSpec) Set the algorithm parameter spec to be used with the private key.
-
Constructor Details
-
Builder
public Builder(PrivateKey privateKey, byte[] encapsulation, String algorithmName, int keySizeInBits) Basic builder.- Parameters:
privateKey
- the private key to use to extract the secret from the encapsulation.encapsulation
- the encapsulated secret.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
public Builder(PrivateKey privateKey, byte[] encapsulation, String algorithmName, int keySizeInBits, byte[] otherInfo) Basic builder.- Parameters:
privateKey
- the private key to use to extract the secret from the encapsulation.encapsulation
- the encapsulated secret.algorithmName
- the algorithm name for the secret key we wish to calculate.keySizeInBits
- the size of the key we want to produce in bits.
-
-
Method Details
-
withKdfAlgorithm
public KTSExtractKeySpec.Builder withKdfAlgorithm(FipsKDF.AgreementKDFParametersBuilder kdfAlgorithm) Set the KDF algorithm and digest algorithm for key generation (ignored for OAEP).- Parameters:
kdfAlgorithm
- the KDF algorithm to apply.- Returns:
- the current Builder instance.
-
withKdfAlgorithm
Set the KDF algorithm and digest algorithm for key generation (ignored for OAEP).- 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.
-
withMac
Set the MAC algorithm name and its associated key size for the MAC key in the encapsulation.- 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 private key.- Parameters:
parameterSpec
- the algorithm parameter spec to be used in decryption.- Returns:
- the current Builder instance.
-
build
Build the new key spec.- Returns:
- a new key spec configured according to the builder state.
-