Package com.io7m.idstore.model

# Class IdPasswordAlgorithmPBKDF2HmacSHA256

java.lang.Object
com.io7m.idstore.model.IdPasswordAlgorithmPBKDF2HmacSHA256

All Implemented Interfaces:
  `IdPasswordAlgorithmType`

public final class IdPasswordAlgorithmPBKDF2HmacSHA256 extends Object implements IdPasswordAlgorithmType
The PBKDF2 hashing algorithm using a SHA-256 HMAC.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `check(String expectedHash, String receivedPassword, byte[] salt)`
  Check if the given plain text password matches the expected hash.
  `static IdPasswordAlgorithmType`
  `create()`
  Create an algorithm with a strong iteration count and key length.
  `static IdPasswordAlgorithmType`
  `create(int iterationCount)`
  Create an algorithm with the given iteration count and key length.
  `IdPassword`
  `createHashed(String passwordText, byte[] salt)`
  Create a hashed password.
  `boolean`
  `equals(Object o)`
  `int`
  `hashCode()`
  `String`
  `identifier()`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.io7m.idstore.model.IdPasswordAlgorithmType

  `createHashed`

- ## Method Details

  - ### create

    public static IdPasswordAlgorithmType create(int iterationCount)
    Create an algorithm with the given iteration count and key length.
    Parameters:
      `iterationCount` - The iteration count
    Returns:
      An algorithm

  - ### create

    public static IdPasswordAlgorithmType create()
    Create an algorithm with a strong iteration count and key length.
    Returns:
      An algorithm

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### check

    public boolean check(String expectedHash, String receivedPassword, byte[] salt) throws IdPasswordException
    Description copied from interface: `IdPasswordAlgorithmType`
    Check if the given plain text password matches the expected hash.
    Specified by:
      `check` in interface `IdPasswordAlgorithmType`
    Parameters:
      `expectedHash` - The expected hexadecimal uppercase hash
      `receivedPassword` - The received plain text password
      `salt` - The salt value
    Returns:
      `true` if the password matches
    Throws:
      `IdPasswordException` - On internal errors such as missing algorithm support

  - ### createHashed

    public IdPassword createHashed(String passwordText, byte[] salt) throws IdPasswordException
    Description copied from interface: `IdPasswordAlgorithmType`
    Create a hashed password.
    Specified by:
      `createHashed` in interface `IdPasswordAlgorithmType`
    Parameters:
      `passwordText` - The plain text password
      `salt` - A random salt value
    Returns:
      A hashed password
    Throws:
      `IdPasswordException` - On internal errors such as missing algorithm support

  - ### identifier

    public String identifier()
    Specified by:
      `identifier` in interface `IdPasswordAlgorithmType`
    Returns:
      The password algorithm identifier