Class SymmetricCipher.Builder

java.lang.Object
io.helidon.common.crypto.SymmetricCipher.Builder
All Implemented Interfaces:
Builder<SymmetricCipher.Builder,SymmetricCipher>, Supplier<SymmetricCipher>
Enclosing class:
SymmetricCipher

public static class SymmetricCipher.Builder extends Object implements Builder<SymmetricCipher.Builder,SymmetricCipher>
Builder of the SymmetricCipher.
  • Method Details

    • algorithm

      public SymmetricCipher.Builder algorithm(String algorithm)
      Set algorithm which should be used.
      Default value is SymmetricCipher.ALGORITHM_AES_GCM.
      Parameters:
      algorithm - algorithm to be used
      Returns:
      updated builder instance
    • provider

      public SymmetricCipher.Builder provider(String provider)
      Set provider of the algorithm.
      Parameters:
      provider - provider to be used
      Returns:
      updated builder instance
    • password

      public SymmetricCipher.Builder password(char[] password)
      Set password upon which the cryptography key will be generated.
      Parameters:
      password - base password
      Returns:
      updated builder instance
    • keySize

      public SymmetricCipher.Builder keySize(int keySize)
      Set size of the key (in bits) which should be generated. Default value is 256 bit.
      Parameters:
      keySize - size of the key
      Returns:
      updated builder instance
    • numberOfIterations

      public SymmetricCipher.Builder numberOfIterations(int numberOfIterations)
      Number of iterations which will be used for key derivation from the password. Default value is 10000.
      Parameters:
      numberOfIterations - number of iterations
      Returns:
      updated builder instance
    • additionalAuthenticatedData

      public SymmetricCipher.Builder additionalAuthenticatedData(byte[] additionalAuthenticatedData)
      Set additional authenticated data for authenticated encryption algorithms.

      The configured data is authenticated, but not encrypted. The same value must be configured for decryption. This is supported by authenticated encryption algorithms, such as SymmetricCipher.ALGORITHM_AES_GCM.

      Parameters:
      additionalAuthenticatedData - additional authenticated data
      Returns:
      updated builder instance
    • build

      public SymmetricCipher build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<SymmetricCipher.Builder,SymmetricCipher>
      Returns:
      instance of the built type