Class PasswordKeyDerivation

java.lang.Object
io.helidon.common.crypto.PasswordKeyDerivation

public class PasswordKeyDerivation extends Object
Util class used for encryption key derivation from the password.
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    deriveKey(char[] password, byte[] salt, int iterations, int keySize)
    Derive key from the password with the usage of the salt.
    static byte[]
    deriveKey(String algorithm, String provider, char[] password, byte[] salt, int iterations, int keySize)
    Derive key from the password with the usage of the salt and selected algorithm.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • deriveKey

      public static byte[] deriveKey(char[] password, byte[] salt, int iterations, int keySize)
      Derive key from the password with the usage of the salt.
      Uses algorithm PBKDF2WithHmacSHA256 for password derivation by default.
      Parameters:
      password - base for key derivation
      salt - salt for key derivation
      keySize - output key size in bits
      iterations - number of iterations used in derivation
      Returns:
      derived key from the password
    • deriveKey

      public static byte[] deriveKey(String algorithm, String provider, char[] password, byte[] salt, int iterations, int keySize)
      Derive key from the password with the usage of the salt and selected algorithm.
      Parameters:
      algorithm - algorithm to be used for derivation
      provider - provider of the algorithm
      password - base for key derivation
      salt - salt for key derivation
      keySize - output key size in bits
      iterations - number of iterations used in derivation
      Returns:
      derived key from the password