Class KTSExtractKeySpec.Builder

java.lang.Object
org.bouncycastle.jcajce.spec.KTSExtractKeySpec.Builder
Enclosing class:
KTSExtractKeySpec

public static final class KTSExtractKeySpec.Builder extends Object
Builder class for creating a KTSExtractKeySpec.
  • Constructor Details

    • Builder

      public Builder(PrivateKey privateKey, byte[] encapsulation, String algorithmName, int keySizeInBits)
      Basic builder.
      Parameters:
      privateKey - the private key to use to extract the secret from the encapsulation.
      encapsulation - the encapsulated secret.
      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(PrivateKey privateKey, byte[] encapsulation, String algorithmName, int keySizeInBits, byte[] otherInfo)
      Basic builder.
      Parameters:
      privateKey - the private key to use to extract the secret from the encapsulation.
      encapsulation - the encapsulated secret.
      algorithmName - the algorithm name for the secret key we wish to calculate.
      keySizeInBits - the size of the key we want to produce in bits.
  • Method Details

    • withKdfAlgorithm

      public KTSExtractKeySpec.Builder withKdfAlgorithm(FipsKDF.AgreementKDFParametersBuilder kdfAlgorithm)
      Set the KDF algorithm and digest algorithm for key generation (ignored for OAEP).
      Parameters:
      kdfAlgorithm - the KDF algorithm to apply.
      Returns:
      the current Builder instance.
    • withKdfAlgorithm

      public KTSExtractKeySpec.Builder withKdfAlgorithm(AlgorithmIdentifier kdfAlgorithm)
      Set the KDF algorithm and digest algorithm for key generation (ignored for OAEP).
      Parameters:
      kdfAlgorithm - the KDF algorithm to apply.
      Returns:
      the current Builder instance.
    • withKdfSalt

      public KTSExtractKeySpec.Builder withKdfSalt(byte[] salt)
      Set the KDF salt for key generation (ignored for OAEP).
      Parameters:
      salt - the salt for initialising the KDF PRF.
      Returns:
      the current Builder instance.
    • withMac

      public KTSExtractKeySpec.Builder withMac(String macAlgorithmName, int macKeySizeInBits)
      Set the MAC algorithm name and its associated key size for the MAC key in the encapsulation.
      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 KTSExtractKeySpec.Builder withParameterSpec(AlgorithmParameterSpec parameterSpec)
      Set the algorithm parameter spec to be used with the private key.
      Parameters:
      parameterSpec - the algorithm parameter spec to be used in decryption.
      Returns:
      the current Builder instance.
    • build

      public KTSExtractKeySpec build()
      Build the new key spec.
      Returns:
      a new key spec configured according to the builder state.