public class UsernamePasswordHashUtil extends Object
Constructor and Description |
---|
UsernamePasswordHashUtil()
The default constructor for UsernamePasswordHashUtil, when instantiated
using this constructor a local MD5 MessageDigest will be used for the
generated hashes.
|
UsernamePasswordHashUtil(MessageDigest digest)
Constructor to allow a pre-instantiated MessageDigest to be supplied.
|
Modifier and Type | Method and Description |
---|---|
String |
generateHashedHexURP(String userName,
String realm,
char[] password) |
String |
generateHashedHexURP(String userName,
String realm,
char[] password,
boolean utf8StringConversion) |
byte[] |
generateHashedURP(String userName,
String realm,
char[] password) |
byte[] |
generateHashedURP(String userName,
String realm,
char[] password,
boolean utf8StringConversion)
Takes the supplied username, realm and password and generates the digested { username ':' realm ':' password}
|
static void |
main(String[] args) |
public UsernamePasswordHashUtil() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- - If the MD5 MessageDigest fails to be created.public UsernamePasswordHashUtil(MessageDigest digest)
digest
- The MessageDigest to use for hash generation requests.public byte[] generateHashedURP(String userName, String realm, char[] password, boolean utf8StringConversion)
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.public String generateHashedHexURP(String userName, String realm, char[] password, boolean utf8StringConversion)
public String generateHashedHexURP(String userName, String realm, char[] password)
public static void main(String[] args) throws NoSuchAlgorithmException
NoSuchAlgorithmException
Copyright © 2018 JBoss by Red Hat. All rights reserved.