Class PasswordHasher
java.lang.Object
org.apache.derby.iapi.sql.dictionary.PasswordHasher
This machine performs the hashing of Derby passwords.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private String
private byte[]
private static final String
The encoding to use when converting the credentials to a byte array that can be passed to the hash function in the configurable hash scheme.static final String
Pattern that is prefixed to the stored password in the configurable hash authentication scheme.static final String
Pattern that is prefixed to the stored password in the configurable hash authentication scheme if key stretching has been applied.static final String
Pattern that is prefixed to the stored password in the SHA-1 authentication scheme.private static final char
Character that separates the hash value from the name of the hash algorithm in the stored password generated by the configurable hash authentication scheme. -
Constructor Summary
ConstructorsConstructorDescriptionPasswordHasher
(String hashingScheme) Construct from a hashed BUILTIN password stored in the PropertyConglomerate or from a SYSUSERS.HASHINGSCHEME column.PasswordHasher
(String messageDigestAlgorithm, byte[] salt, int iterations) Construct from pieces. -
Method Summary
Modifier and TypeMethodDescriptionprivate StandardException
Encodes the hashing algorithm in a string suitable for storing in SYSUSERS.HASHINGSCHEME.private MessageDigest
private String
hashAndEncode
(String stringDigest) hashAndEncode
(String userName, String password) Hash a username/password pair and return an encoded representation suitable for storing as a BUILTIN password value in the PropertyConglomerate.hashPasswordIntoString
(String userName, String password) Produce a hashed password using a plaintext username and password.
-
Field Details
-
ENCODING
The encoding to use when converting the credentials to a byte array that can be passed to the hash function in the configurable hash scheme.- See Also:
-
ID_PATTERN_SHA1_SCHEME
Pattern that is prefixed to the stored password in the SHA-1 authentication scheme.- See Also:
-
ID_PATTERN_CONFIGURABLE_HASH_SCHEME
Pattern that is prefixed to the stored password in the configurable hash authentication scheme.- See Also:
-
ID_PATTERN_CONFIGURABLE_STRETCHED_SCHEME
Pattern that is prefixed to the stored password in the configurable hash authentication scheme if key stretching has been applied. This scheme extends the configurable hash scheme by adding a random salt and applying the hash function multiple times when generating the hashed token.- See Also:
-
SEPARATOR_CHAR
private static final char SEPARATOR_CHARCharacter that separates the hash value from the name of the hash algorithm in the stored password generated by the configurable hash authentication scheme.- See Also:
-
_messageDigestAlgorithm
-
_salt
private byte[] _salt -
_iterations
private int _iterations
-
-
Constructor Details
-
PasswordHasher
Construct from pieces. Used for databases at rev level 10.6 or later.
-
PasswordHasher
Construct from a hashed BUILTIN password stored in the PropertyConglomerate or from a SYSUSERS.HASHINGSCHEME column.
-
-
Method Details
-
hashPasswordIntoString
Produce a hashed password using a plaintext username and password. Turn it into a printable string.
- Throws:
StandardException
-
getEmptyMessageDigest
- Throws:
StandardException
-
badMessageDigest
-
encodeHashingScheme
Encodes the hashing algorithm in a string suitable for storing in SYSUSERS.HASHINGSCHEME.
-
hashAndEncode
Hash a username/password pair and return an encoded representation suitable for storing as a BUILTIN password value in the PropertyConglomerate.
- Throws:
StandardException
-
hashAndEncode
-