Package org.bouncycastle.jcajce.spec
Class KTSGenerateKeySpec.Builder
- java.lang.Object
-
- org.bouncycastle.jcajce.spec.KTSGenerateKeySpec.Builder
-
- Enclosing class:
- KTSGenerateKeySpec
public static final class KTSGenerateKeySpec.Builder extends java.lang.Object
Builder class for creating a KTSGenerateKeySpec.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KTSGenerateKeySpec
build()
Build the new key spec.KTSGenerateKeySpec.Builder
withKdfAlgorithm(AlgorithmIdentifier kdfAlgorithm)
Set the KDF algorithm and digest algorithm for key generation.KTSGenerateKeySpec.Builder
withKdfAlgorithm(FipsKDF.AgreementKDFParametersBuilder kdfBuilder)
Set the KDF algorithm and digest algorithm for key generation.KTSGenerateKeySpec.Builder
withMac(java.lang.String macAlgorithmName, int macKeySizeInBits)
Set the MAC algorithm name and its associated key size for the MAC key section of the secret.KTSGenerateKeySpec.Builder
withParameterSpec(java.security.spec.AlgorithmParameterSpec parameterSpec)
Set the algorithm parameter spec to be used with the public key.KTSGenerateKeySpec.Builder
withSecureRandom(java.security.SecureRandom random)
Set the SecureRandom which will be used to generate the secret.
-
-
-
Constructor Detail
-
Builder
public Builder(java.security.PublicKey publicKey, java.lang.String algorithmName, int keySizeInBits)
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
public Builder(java.security.PublicKey publicKey, java.lang.String algorithmName, int keySizeInBits, byte[] otherInfo)
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 Detail
-
withSecureRandom
public KTSGenerateKeySpec.Builder withSecureRandom(java.security.SecureRandom random)
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
public KTSGenerateKeySpec.Builder withMac(java.lang.String macAlgorithmName, int macKeySizeInBits)
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
public KTSGenerateKeySpec.Builder withParameterSpec(java.security.spec.AlgorithmParameterSpec parameterSpec)
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
public KTSGenerateKeySpec.Builder withKdfAlgorithm(AlgorithmIdentifier kdfAlgorithm)
Set the KDF algorithm and digest algorithm for key generation.- Parameters:
kdfAlgorithm
- the KDF algorithm to apply.- Returns:
- the current Builder instance.
-
build
public KTSGenerateKeySpec build()
Build the new key spec.- Returns:
- a new key spec configured according to the builder state.
-
-