Class UsernamePasswordHashUtil


  • @Deprecated
    public class UsernamePasswordHashUtil
    extends Object
    Deprecated.
    Use PasswordFactory instead.
    A utility class for generating both the {user-name : realm-value : passwd } hash and the hex encoded version of the hash.

    This class makes use of the MessageDigest by single calls to the .digest(byte[]) method, however beyond that there is no synchronisation so this should not be considered thread safe.

    Author:
    Darran Lofthouse
    • Constructor Detail

      • UsernamePasswordHashUtil

        public UsernamePasswordHashUtil()
                                 throws NoSuchAlgorithmException
        Deprecated.
        The default constructor for UsernamePasswordHashUtil, when instantiated using this constructor a local MD5 MessageDigest will be used for the generated hashes.
        Throws:
        NoSuchAlgorithmException - - If the MD5 MessageDigest fails to be created.
      • UsernamePasswordHashUtil

        public UsernamePasswordHashUtil​(MessageDigest digest)
        Deprecated.
        Constructor to allow a pre-instantiated MessageDigest to be supplied.

        The supplied MessageDigest will be used for the hash generation requests,

        Parameters:
        digest - The MessageDigest to use for hash generation requests.
    • Method Detail

      • generateHashedURP

        public byte[] generateHashedURP​(String userName,
                                        String realm,
                                        char[] password,
                                        boolean utf8StringConversion)
        Deprecated.
        Takes the supplied username, realm and password and generates the digested { username ':' realm ':' password }
        Parameters:
        userName - The username to use in the generated hash.
        realm - The realm to use in the generated hash.
        password - The password to use in the generated hash.
        utf8StringConversion - Should a conversion to UTF-8 be allowed if non 8859_1 chars are encountered.
        Returns:
        The generated hash.
      • generateHashedURP

        public byte[] generateHashedURP​(String userName,
                                        String realm,
                                        char[] password)
        Deprecated.
      • generateHashedHexURP

        public String generateHashedHexURP​(String userName,
                                           String realm,
                                           char[] password,
                                           boolean utf8StringConversion)
        Deprecated.
      • generateHashedHexURP

        public String generateHashedHexURP​(String userName,
                                           String realm,
                                           char[] password)
        Deprecated.