com.mysql.jdbc
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)
DOCUMENT ME!
|
(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 void |
passwordCrypt(byte[] from,
byte[] to,
byte[] password,
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
|
(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,
Connection conn) |
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
- DOCUMENT ME!usingNewPasswords
- DOCUMENT ME!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.static void passwordCrypt(byte[] from, byte[] to, byte[] password, int length)
from
- IN Data for encryptionto
- OUT Encrypt data to the buffer (may be the same)password
- IN Password used for encryption (same length)length
- 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, Connection conn) throws java.security.NoSuchAlgorithmException, java.io.UnsupportedEncodingException
java.security.NoSuchAlgorithmException
java.io.UnsupportedEncodingException