Class AbstractPasswordHashCreatorPBKDF2

    • Field Detail

      • m_sPBKDF2AlgorithmName

        protected final String m_sPBKDF2AlgorithmName
      • m_nIterations

        protected final int m_nIterations
      • m_nHashBytes

        protected final int m_nHashBytes
    • Method Detail

      • requiresSalt

        public final boolean requiresSalt()
        Returns:
        true if this hash creator requires a salt, false if not.
      • pbkdf2

        @Nonnull
        protected static final byte[] pbkdf2​(@Nonnull
                                             char[] aPassword,
                                             @Nonnull
                                             byte[] aSalt,
                                             @Nonnegative
                                             int nIterations,
                                             @Nonnegative
                                             int nBytes,
                                             @Nonnull @Nonempty
                                             String sPBKDF2AlgorithmName)
        Computes the PBKDF2 hash of a password.
        Parameters:
        aPassword - the password to hash.
        aSalt - the salt
        nIterations - the iteration count (slowness factor)
        nBytes - the length of the hash to compute in bytes
        sPBKDF2AlgorithmName - The SecretKeyFactory parameter to use. May neither be null nor empty.
        Returns:
        the PBDKF2 hash of the password
      • createPasswordHash

        @Nonnull
        public String createPasswordHash​(@Nonnull
                                         IPasswordSalt aSalt,
                                         @Nonnull
                                         String sPlainTextPassword)
        Description copied from interface: IPasswordHashCreator
        The method to create a message digest hash from a password.
        Parameters:
        aSalt - Optional salt to be used. This parameter is only null for backwards compatibility reasons.
        sPlainTextPassword - Plain text password. May not be null.
        Returns:
        The String representation of the password hash. Must be valid to encode in UTF-8.