类 Security
- java.lang.Object
-
- com.mysql.cj.protocol.Security
-
public class Security extends Object
Methods for doing secure authentication with MySQL-4.1 and newer.
-
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static byte[]scramble411(byte[] password, byte[] seed)Hashing for MySQL-4.1 authentication.static byte[]scramble411(String password, byte[] seed, String passwordEncoding)static byte[]scrambleCachingSha2(byte[] password, byte[] seed)Scrambling for caching_sha2_password plugin.static voidxorString(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 encrypt random strings
-
-
-
方法详细资料
-
xorString
public 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 encrypt random strings- 参数:
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 encrypt
-
scramble411
public static byte[] scramble411(String password, byte[] seed, String passwordEncoding)
-
scramble411
public static byte[] scramble411(byte[] password, byte[] seed)Hashing for MySQL-4.1 authentication. Algorithm is as follows (c.f. sql/auth/password.c):SERVER: public_seed=create_random_string() send(public_seed) CLIENT: recv(public_seed) hash_stage1=sha1("password") hash_stage2=sha1(hash_stage1) reply=xor(hash_stage1, sha1(public_seed,hash_stage2)) send(reply)- 参数:
password- passwordseed- seed- 返回:
- bytes
-
scrambleCachingSha2
public static byte[] scrambleCachingSha2(byte[] password, byte[] seed) throws DigestExceptionScrambling for caching_sha2_password plugin.Scramble = XOR(SHA2(password), SHA2(SHA2(SHA2(password)), Nonce))
- 参数:
password- passwordseed- seed- 返回:
- bytes
- 抛出:
DigestException- if an error occurs
-
-