public class Security
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
(package private) static byte[] |
createKeyFromOldPassword(java.lang.String passwd)
Creates key from old password to decode scramble Used in 4.1
authentication with passwords stored pre-4.1 hashing.
|
(package private) static byte[] |
getBinaryPassword(int[] salt,
boolean usingNewPasswords) |
(package private) static java.lang.String |
makeScrambledPassword(java.lang.String password)
Creates password to be stored in user database from raw string.
|
(package private) static byte[] |
passwordHashStage1(java.lang.String password)
Stage one password hashing, used in MySQL 4.1 password handling
|
(package private) static byte[] |
passwordHashStage2(byte[] hashedPassword,
byte[] salt)
Stage two password hashing used in MySQL 4.1 password handling
|
static byte[] |
scramble411(java.lang.String password,
java.lang.String seed,
java.lang.String passwordEncoding) |
static void |
xorString(byte[] from,
byte[] to,
byte[] scramble,
int length)
Encrypt/Decrypt function used for password encryption in authentication
Simple XOR is used here but it is OK as we crypt random strings
|
static byte[] createKeyFromOldPassword(java.lang.String passwd)
throws java.security.NoSuchAlgorithmException
passwd - the password to create the key fromjava.security.NoSuchAlgorithmException - if the message digest 'SHA-1' is not available.static byte[] getBinaryPassword(int[] salt,
boolean usingNewPasswords)
throws java.security.NoSuchAlgorithmException
salt - usingNewPasswords - java.security.NoSuchAlgorithmException - if the message digest 'SHA-1' is not available.static java.lang.String makeScrambledPassword(java.lang.String password)
throws java.security.NoSuchAlgorithmException
password - plaintext passwordjava.security.NoSuchAlgorithmException - if the message digest 'SHA-1' is not available.public static void xorString(byte[] from,
byte[] to,
byte[] scramble,
int length)
from - IN Data for encryptionto - OUT Encrypt data to the buffer (may be the same)scramble - IN Scramble used for encryptionlength - IN Length of data to encryptstatic byte[] passwordHashStage1(java.lang.String password)
throws java.security.NoSuchAlgorithmException
password - plaintext passwordjava.security.NoSuchAlgorithmException - if the message digest 'SHA-1' is not available.static byte[] passwordHashStage2(byte[] hashedPassword,
byte[] salt)
throws java.security.NoSuchAlgorithmException
hash - from passwordHashStage1salt - salt used for stage two hashingjava.security.NoSuchAlgorithmException - if the message digest 'SHA-1' is not available.public static byte[] scramble411(java.lang.String password,
java.lang.String seed,
java.lang.String passwordEncoding)
throws java.security.NoSuchAlgorithmException,
java.io.UnsupportedEncodingException
java.security.NoSuchAlgorithmExceptionjava.io.UnsupportedEncodingException