Class StrongPasswordProcessor


  • public class StrongPasswordProcessor
    extends java.lang.Object
    This class implements a a `PBKDF2WithHmacSHA1` based password digest creator and validator. Following steps are taken during the creation of the digest: 1. A salt is generated. 2. The password is encoded with this salt. 3. Number of iterations, salt and this password is string encoded and concatenated with ":" as separator. 4. This whole string is again string encoded with base 16. For validation these steps are reversed to get the password digest from the stored password. The incoming password is digested with the retrieved iterations and salt. The generated digest is then cross checked against the created digest.
    • Method Detail

      • checkPassword

        public boolean checkPassword​(char[] password,
                                     java.lang.String encryptedPassword)
                              throws java.security.NoSuchAlgorithmException,
                                     java.security.spec.InvalidKeySpecException
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.spec.InvalidKeySpecException
      • encryptPassword

        public java.lang.String encryptPassword​(java.lang.String userPassword)
                                         throws java.security.NoSuchAlgorithmException,
                                                java.security.spec.InvalidKeySpecException
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.spec.InvalidKeySpecException