Interface MaskedPassword

All Superinterfaces:
Cloneable, Destroyable, Key, Password, Serializable, TwoWayPassword

public interface MaskedPassword extends TwoWayPassword
A password which has been masked, PicketBox style.
Author:
David M. Lloyd
  • Field Details

  • Method Details

    • isMaskedAlgorithm

      static boolean isMaskedAlgorithm(String name)
      Determine if the given algorithm name is a valid masked password algorithm name.
      Parameters:
      name - the algorithm name
      Returns:
      true if the algorithm name is valid for this password type, false otherwise
    • getPBEName

      static String getPBEName(String name)
      Get the name of the PBE algorithm that goes with the given password algorithm name.
      Parameters:
      name - the password algorithm name
      Returns:
      the PBE algorithm name, or null if the password algorithm name was null or not recognized
    • getInitialKeyMaterial

      char[] getInitialKeyMaterial()
      Get the initial key material.
      Returns:
      the initial key material (must not be null)
    • getIterationCount

      int getIterationCount()
      Get the iteration count.
      Returns:
      the iteration count
    • getSalt

      byte[] getSalt()
      Get the salt bytes.
      Returns:
      the salt bytes (must not be null)
    • getMaskedPasswordBytes

      byte[] getMaskedPasswordBytes()
      Get the masked password bytes.
      Returns:
      the masked password bytes (must not be null)
    • getInitializationVector

      default byte[] getInitializationVector()
      Get the initialization vector.
      Returns:
      the initialization vector (null if not used)
    • getParameterSpec

      default MaskedPasswordAlgorithmSpec getParameterSpec()
      Description copied from interface: Password
      Get the applicable algorithm parameter specification for this password type.
      Specified by:
      getParameterSpec in interface Password
      Returns:
      the algorithm parameter specification, or null if this password type does not support algorithms
    • impliesParameters

      default boolean impliesParameters(AlgorithmParameterSpec parameterSpec)
      Description copied from interface: Password
      Determine if this password is matched by the given parameter specification.
      Specified by:
      impliesParameters in interface Password
      Parameters:
      parameterSpec - the parameter specification (must not be null)
      Returns:
      true if the password is matched by the parameters, false otherwise
    • clone

      Description copied from interface: TwoWayPassword
      Creates and returns a copy of this Password.
      Specified by:
      clone in interface Password
      Specified by:
      clone in interface TwoWayPassword
      Returns:
      a copy of this Password.
    • createRaw

      static MaskedPassword createRaw(String algorithm, char[] initialKeyMaterial, int iterationCount, byte[] salt, byte[] maskedPasswordBytes)
      Create a raw instance of this password type.
      Parameters:
      algorithm - the algorithm name (must not be null)
      initialKeyMaterial - the initial key material (must not be null)
      iterationCount - the iteration count
      salt - the salt (must not be null)
      maskedPasswordBytes - the masked password bytes (must not be null)
      Returns:
      the raw instance (not null)
    • createRaw

      static MaskedPassword createRaw(String algorithm, char[] initialKeyMaterial, int iterationCount, byte[] salt, byte[] maskedPasswordBytes, byte[] initializationVector)
      Create a raw instance of this password type.
      Parameters:
      algorithm - the algorithm name (must not be null)
      initialKeyMaterial - the initial key material (must not be null)
      iterationCount - the iteration count
      salt - the salt (must not be null)
      maskedPasswordBytes - the masked password bytes (must not be null)
      initializationVector - the initialization vector (can be null)
      Returns:
      the raw instance (not null)