Bouncy Castle Cryptography Library 1.81

org.bouncycastle.jcajce.spec
Class KEMGenerateSpec.Builder

java.lang.Object
  extended byorg.bouncycastle.jcajce.spec.KEMGenerateSpec.Builder
Enclosing class:
KEMGenerateSpec

public static final class KEMGenerateSpec.Builder
extends java.lang.Object

Builder class for creating a KEMGenerateSpec.


Constructor Summary
KEMGenerateSpec.Builder(java.security.PublicKey publicKey, java.lang.String keyAlgorithmName, int keySizeInBits)
          Basic builder.
 
Method Summary
 KEMGenerateSpec build()
          Build the new parameter spec.
 KEMGenerateSpec.Builder withKdfAlgorithm(AlgorithmIdentifier kdfAlgorithm)
          Set the KDF algorithm and digest algorithm for wrap key generation.
 KEMGenerateSpec.Builder withNoKdf()
          Use the shared secret directly for key wrap generation.
 KEMGenerateSpec.Builder withOtherInfo(byte[] otherInfo)
          Set the OtherInfo to use with the KDF.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KEMGenerateSpec.Builder

public KEMGenerateSpec.Builder(java.security.PublicKey publicKey,
                               java.lang.String keyAlgorithmName,
                               int keySizeInBits)
Basic builder.

Parameters:
publicKey - the public key to use for encapsulation/secret generation.
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 KEMGenerateSpec.Builder withNoKdf()
Use the shared secret directly for key wrap generation.

Returns:
the current Builder instance.

withKdfAlgorithm

public KEMGenerateSpec.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 KEMGenerateSpec.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 KEMGenerateSpec build()
Build the new parameter spec.

Returns:
a new parameter spec configured according to the builder state.

Bouncy Castle Cryptography Library 1.81