Top Inners Fields Constructors Methods
org.bouncycastle.jcajce.spec

public Class KEMGenerateSpec

extends KEMKDFSpec
implements AlgorithmParameterSpec
Class Inheritance
All Implemented Interfaces
java.security.spec.AlgorithmParameterSpec
Imports
java.security.PublicKey, java.security.spec.AlgorithmParameterSpec, org.bouncycastle.asn1.nist.NISTObjectIdentifiers, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.asn1.x9.X9ObjectIdentifiers, org.bouncycastle.util.Arrays

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
KEMGenerateSpec.Builder

Builder class for creating a KEMGenerateSpec.

Field Summary

Modifier and TypeField and Description
private static AlgorithmIdentifier
private static final byte[]
private final PublicKey

Constructor Summary

AccessConstructor and Description
private
KEMGenerateSpec(PublicKey publicKey, String keyAlgorithmName, int keySizeInBits, AlgorithmIdentifier kdfAlgorithm, byte[] otherInfo)

public
KEMGenerateSpec(PublicKey publicKey, String keyAlgorithmName)

public
KEMGenerateSpec(PublicKey publicKey, String keyAlgorithmName, int keySizeInBits)

Method Summary

Modifier and TypeMethod and Description
public PublicKey
Inherited from org.bouncycastle.jcajce.spec.KEMKDFSpec:
getKdfAlgorithmgetKeyAlgorithmNamegetKeySizegetOtherInfo

Field Detail

DefKdfback to summary
private static AlgorithmIdentifier DefKdf
EMPTY_OTHER_INFOback to summary
private static final byte[] EMPTY_OTHER_INFO
publicKeyback to summary
private final PublicKey publicKey

Constructor Detail

KEMGenerateSpecback to summary
private KEMGenerateSpec(PublicKey publicKey, String keyAlgorithmName, int keySizeInBits, AlgorithmIdentifier kdfAlgorithm, byte[] otherInfo)
KEMGenerateSpecback to summary
public KEMGenerateSpec(PublicKey publicKey, String keyAlgorithmName)
KEMGenerateSpecback to summary
public KEMGenerateSpec(PublicKey publicKey, String keyAlgorithmName, int keySizeInBits)

Method Detail

getPublicKeyback to summary
public PublicKey getPublicKey()
org.bouncycastle.jcajce.spec back to summary

public final Class KEMGenerateSpec.Builder

extends Object
Class Inheritance

Builder class for creating a KEMGenerateSpec.

Field Summary

Modifier and TypeField and Description
private final String
private AlgorithmIdentifier
private final int
private byte[]
private final PublicKey

Constructor Summary

AccessConstructor and Description
public
Builder(PublicKey
the public key to use for encapsulation/secret generation.
publicKey
,
String
the algorithm name for the secret key we want to generate.
keyAlgorithmName
,
int
the size of the wrapping key we want to produce in bits.
keySizeInBits
)

Basic builder.

Method Summary

Modifier and TypeMethod and Description
public KEMGenerateSpec

Returns:

a new parameter spec configured according to the builder state.
build
()

Build the new parameter spec.

public KEMGenerateSpec.Builder

Returns:

the current Builder instance.
withKdfAlgorithm
(AlgorithmIdentifier
the KDF algorithm to apply.
kdfAlgorithm
)

Set the KDF algorithm and digest algorithm for wrap key generation.

public KEMGenerateSpec.Builder

Returns:

the current Builder instance.
withNoKdf
()

Use the shared secret directly for key wrap generation.

public KEMGenerateSpec.Builder

Returns:

the current Builder instance.
withOtherInfo
(byte[]
the other info to use.
otherInfo
)

Set the OtherInfo to use with the KDF.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

algorithmNameback to summary
private final String algorithmName
kdfAlgorithmback to summary
private AlgorithmIdentifier kdfAlgorithm
keySizeInBitsback to summary
private final int keySizeInBits
otherInfoback to summary
private byte[] otherInfo
publicKeyback to summary
private final PublicKey publicKey

Constructor Detail

Builderback to summary
public Builder(PublicKey publicKey, String keyAlgorithmName, int keySizeInBits)

Basic builder.

Parameters
publicKey:PublicKey

the public key to use for encapsulation/secret generation.

keyAlgorithmName:String

the algorithm name for the secret key we want to generate.

keySizeInBits:int

the size of the wrapping key we want to produce in bits.

Method Detail

buildback to summary
public KEMGenerateSpec build()

Build the new parameter spec.

Returns:KEMGenerateSpec

a new parameter spec configured according to the builder state.

withKdfAlgorithmback to summary
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:AlgorithmIdentifier

the KDF algorithm to apply.

Returns:KEMGenerateSpec.Builder

the current Builder instance.

withNoKdfback to summary
public KEMGenerateSpec.Builder withNoKdf()

Use the shared secret directly for key wrap generation.

Returns:KEMGenerateSpec.Builder

the current Builder instance.

withOtherInfoback to summary
public KEMGenerateSpec.Builder withOtherInfo(byte[] otherInfo)

Set the OtherInfo to use with the KDF. The default OtherInfo is a zero length byte[].

Parameters
otherInfo:byte[]

the other info to use.

Returns:KEMGenerateSpec.Builder

the current Builder instance.