Package org.bouncycastle.jcajce.spec
Class KEMExtractSpec.Builder
- java.lang.Object
-
- org.bouncycastle.jcajce.spec.KEMExtractSpec.Builder
-
- Enclosing class:
- KEMExtractSpec
public static final class KEMExtractSpec.Builder extends java.lang.Object
Builder class for creating a KEMExtractSpec.
-
-
Constructor Summary
Constructors Constructor Description Builder(java.security.PrivateKey privateKey, byte[] encapsulation, java.lang.String keyAlgorithmName, int keySizeInBits)
Basic builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KEMExtractSpec
build()
Build the new parameter spec.KEMExtractSpec.Builder
withKdfAlgorithm(AlgorithmIdentifier kdfAlgorithm)
Set the KDF algorithm and digest algorithm for wrap key generation.KEMExtractSpec.Builder
withNoKdf()
Use the shared secret directly for key wrap generation.KEMExtractSpec.Builder
withOtherInfo(byte[] otherInfo)
Set the OtherInfo to use with the KDF.
-
-
-
Constructor Detail
-
Builder
public Builder(java.security.PrivateKey privateKey, byte[] encapsulation, java.lang.String keyAlgorithmName, int keySizeInBits)
Basic builder.- Parameters:
privateKey
- the private key to use for the secret extraction.encapsulation
- the encapsulation to process.keyAlgorithmName
- the algorithm name for the secret key we want to generate.keySizeInBits
- the size of the wrapping key we want to produce in bits.
-
-
Method Detail
-
withNoKdf
public KEMExtractSpec.Builder withNoKdf()
Use the shared secret directly for key wrap generation.- Returns:
- the current Builder instance.
-
withKdfAlgorithm
public KEMExtractSpec.Builder withKdfAlgorithm(AlgorithmIdentifier kdfAlgorithm)
Set the KDF algorithm and digest algorithm for wrap key generation. The default KDF is X9.44 KDF-3, also known as the NIST concatenation KDF.- Parameters:
kdfAlgorithm
- the KDF algorithm to apply.- Returns:
- the current Builder instance.
-
withOtherInfo
public KEMExtractSpec.Builder withOtherInfo(byte[] otherInfo)
Set the OtherInfo to use with the KDF. The default OtherInfo is a zero length byte[].- Parameters:
otherInfo
- the other info to use.- Returns:
- the current Builder instance.
-
build
public KEMExtractSpec build()
Build the new parameter spec.- Returns:
- a new parameter spec configured according to the builder state.
-
-