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

public Class KTSGenerateKeySpec

extends KTSKeySpec
Class Inheritance
Imports
java.security.PublicKey, .SecureRandom, java.security.spec.AlgorithmParameterSpec, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.crypto.fips.FipsKDF

KeySpec for use with secret key generation with a SecretKeyFactory supporting KTS.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
KTSGenerateKeySpec.Builder

Builder class for creating a KTSGenerateKeySpec.

Field Summary

Modifier and TypeField and Description
private final PublicKey
private final SecureRandom
Inherited from org.bouncycastle.jcajce.spec.KTSKeySpec:
KDF2KDF3

Constructor Summary

AccessConstructor and Description
private
KTSGenerateKeySpec(PublicKey publicKey, String algorithmName, int keySize, SecureRandom random, String macAlgorithm, int macKeySizeInBits, AlgorithmParameterSpec parameterSpec, AlgorithmIdentifier kdfAlgorithm, byte[] otherInfo)

Method Summary

Modifier and TypeMethod and Description
public PublicKey

Returns:

the public key to be used for secret encryption.
getPublicKey
()

Return the public key to be used to encrypt the secret and make the encapsulation.

public SecureRandom

Returns:

the source of randomness for the secret.
getSecureRandom
()

Return the SecureRandom which will be used to generate the secret.

Inherited from org.bouncycastle.jcajce.spec.KTSKeySpec:
copyOtherInfocreateAlgIdgetKdfAlgorithmIdgetKeyAlgorithmNamegetKeySizegetMacAlgorithmNamegetMacKeySizegetOtherInfogetParameterSpec

Field Detail

publicKeyback to summary
private final PublicKey publicKey
randomback to summary
private final SecureRandom random

Constructor Detail

KTSGenerateKeySpecback to summary
private KTSGenerateKeySpec(PublicKey publicKey, String algorithmName, int keySize, SecureRandom random, String macAlgorithm, int macKeySizeInBits, AlgorithmParameterSpec parameterSpec, AlgorithmIdentifier kdfAlgorithm, byte[] otherInfo)

Method Detail

getPublicKeyback to summary
public PublicKey getPublicKey()

Return the public key to be used to encrypt the secret and make the encapsulation.

Returns:PublicKey

the public key to be used for secret encryption.

getSecureRandomback to summary
public SecureRandom getSecureRandom()

Return the SecureRandom which will be used to generate the secret.

Returns:SecureRandom

the source of randomness for the secret.

org.bouncycastle.jcajce.spec back to summary

public final Class KTSGenerateKeySpec.Builder

extends Object
Class Inheritance

Builder class for creating a KTSGenerateKeySpec.

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
Builder(PublicKey
the public key to be used for encryption/encapsulation generation.
publicKey
,
String
the algorithm name for the secret key we wish to calculate.
algorithmName
,
int
the size of the key we want to produce in bits.
keySizeInBits
)

Basic builder.

public
Builder(PublicKey
the public key to be used for encryption/encapsulation generation.
publicKey
,
String
the algorithm name for the secret key we wish to calculate.
algorithmName
,
int
the size of the key we want to produce in bits.
keySizeInBits
,
byte[]
the otherInfo/IV encoding to be applied to the KDF.
otherInfo
)

Basic builder.

Method Summary

Modifier and TypeMethod and Description
public KTSGenerateKeySpec

Returns:

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

Build the new key spec.

public KTSGenerateKeySpec.Builder

Returns:

the current Builder instance.
withKdfAlgorithm
(FipsKDF.AgreementKDFParametersBuilder
the KDF algorithm to apply.
kdfBuilder
)

Set the KDF algorithm and digest algorithm for key generation.

public KTSGenerateKeySpec.Builder

Returns:

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

Set the KDF algorithm and digest algorithm for key generation.

public KTSGenerateKeySpec.Builder

Returns:

the current Builder instance.
withMac
(String
name of the MAC algorithm we will use.
macAlgorithmName
,
int
size of the MAC key (in bits)
macKeySizeInBits
)

Set the MAC algorithm name and its associated key size for the MAC key section of the secret.

public KTSGenerateKeySpec.Builder

Returns:

the current Builder instance.
withParameterSpec
(AlgorithmParameterSpec
the algorithm parameter spec to be used in encryption.
parameterSpec
)

Set the algorithm parameter spec to be used with the public key.

public KTSGenerateKeySpec.Builder

Returns:

the current Builder instance.
withSecureRandom
(SecureRandom
the source of randomness for the secret.
random
)

Set the SecureRandom which will be used to generate the secret.

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
macAlgorithmback to summary
private String macAlgorithm
macKeySizeInBitsback to summary
private int macKeySizeInBits
otherInfoback to summary
private byte[] otherInfo
parameterSpecback to summary
private AlgorithmParameterSpec parameterSpec
publicKeyback to summary
private final PublicKey publicKey
randomback to summary
private SecureRandom random

Constructor Detail

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

Basic builder.

Parameters
publicKey:PublicKey

the public key to be used for encryption/encapsulation generation.

algorithmName:String

the algorithm name for the secret key we wish to calculate.

keySizeInBits:int

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

Builderback to summary
public Builder(PublicKey publicKey, String algorithmName, int keySizeInBits, byte[] otherInfo)

Basic builder.

Parameters
publicKey:PublicKey

the public key to be used for encryption/encapsulation generation.

algorithmName:String

the algorithm name for the secret key we wish to calculate.

keySizeInBits:int

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

otherInfo:byte[]

the otherInfo/IV encoding to be applied to the KDF.

Method Detail

buildback to summary
public KTSGenerateKeySpec build()

Build the new key spec.

Returns:KTSGenerateKeySpec

a new key spec configured according to the builder state.

withKdfAlgorithmback to summary
public KTSGenerateKeySpec.Builder withKdfAlgorithm(FipsKDF.AgreementKDFParametersBuilder kdfBuilder)

Set the KDF algorithm and digest algorithm for key generation.

Parameters
kdfBuilder:FipsKDF.AgreementKDFParametersBuilder

the KDF algorithm to apply.

Returns:KTSGenerateKeySpec.Builder

the current Builder instance.

withKdfAlgorithmback to summary
public KTSGenerateKeySpec.Builder withKdfAlgorithm(AlgorithmIdentifier kdfAlgorithm)

Set the KDF algorithm and digest algorithm for key generation.

Parameters
kdfAlgorithm:AlgorithmIdentifier

the KDF algorithm to apply.

Returns:KTSGenerateKeySpec.Builder

the current Builder instance.

withMacback to summary
public KTSGenerateKeySpec.Builder withMac(String macAlgorithmName, int macKeySizeInBits)

Set the MAC algorithm name and its associated key size for the MAC key section of the secret.

Parameters
macAlgorithmName:String

name of the MAC algorithm we will use.

macKeySizeInBits:int

size of the MAC key (in bits)

Returns:KTSGenerateKeySpec.Builder

the current Builder instance.

withParameterSpecback to summary
public KTSGenerateKeySpec.Builder withParameterSpec(AlgorithmParameterSpec parameterSpec)

Set the algorithm parameter spec to be used with the public key.

Parameters
parameterSpec:AlgorithmParameterSpec

the algorithm parameter spec to be used in encryption.

Returns:KTSGenerateKeySpec.Builder

the current Builder instance.

withSecureRandomback to summary
public KTSGenerateKeySpec.Builder withSecureRandom(SecureRandom random)

Set the SecureRandom which will be used to generate the secret.

Parameters
random:SecureRandom

the source of randomness for the secret.

Returns:KTSGenerateKeySpec.Builder

the current Builder instance.