Class JsonWebSecretKey.Builder

java.lang.Object
de.christofreichardt.json.webkey.JsonWebKey.Builder<JsonWebSecretKey.Builder>
de.christofreichardt.json.webkey.JsonWebSecretKey.Builder
Enclosing class:
JsonWebSecretKey

public static class JsonWebSecretKey.Builder extends JsonWebKey.Builder<JsonWebSecretKey.Builder>
A JsonWebKey.Builder for building JsonWebSecretKeys by specifying an algorithm and a keysize.
Author:
Christof Reichardt
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • withKeysize

      public JsonWebSecretKey.Builder withKeysize(int keysize)
      Indicates the keysize to be used when generating the SecretKey.
      Parameters:
      keysize - the to be used keysize
      Returns:
      this JsonWebSecretKey.Builder instance
    • withAlgorithm

      public JsonWebSecretKey.Builder withAlgorithm(String algorithm) throws NoSuchAlgorithmException
      Indicates the algorithm to be used when generating the SecretKey.
      Parameters:
      algorithm - the to be used algorithm
      Returns:
      this JsonWebSecretKey.Builder instance
      Throws:
      NoSuchAlgorithmException - if the requested algorithm is not supported
    • build

      Builds the JsonWebSecretKey with the configured parameters.
      Returns:
      the appropriately configured JsonWebSecretKey instance
      Throws:
      NoSuchAlgorithmException - relayed from the underlying "Java Cryptography Architecture"