Class CachingSha2PasswordPlugin
java.lang.Object
org.mariadb.jdbc.internal.com.send.authentication.CachingSha2PasswordPlugin
- All Implemented Interfaces:
AuthenticationPlugin
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(String authenticationData, byte[] seed, Options options) Initialized data.name()Authentication plugin name.process(PacketOutputStream out, PacketInputStream in, AtomicInteger sequence) Process native password plugin authentication.static byte[]sha256encryptPassword(String password, byte[] seed, String passwordCharacterEncoding) Send a SHA-2 encrypted password.type()Authentication plugin type.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AuthenticationPlugin
mustUseSsl
-
Field Details
-
TYPE
- See Also:
-
-
Constructor Details
-
CachingSha2PasswordPlugin
public CachingSha2PasswordPlugin()
-
-
Method Details
-
sha256encryptPassword
public static byte[] sha256encryptPassword(String password, byte[] seed, String passwordCharacterEncoding) throws NoSuchAlgorithmException, UnsupportedEncodingException Send a SHA-2 encrypted password. encryption XOR(SHA256(password), SHA256(seed, SHA256(SHA256(password))))- Parameters:
password- passwordseed- seedpasswordCharacterEncoding- option if not using default byte encoding- Returns:
- encrypted pwd
- Throws:
NoSuchAlgorithmException- if SHA-256 algorithm is unknownUnsupportedEncodingException- if SHA-256 algorithm is unknown
-
name
Description copied from interface:AuthenticationPluginAuthentication plugin name.- Specified by:
namein interfaceAuthenticationPlugin- Returns:
- authentication plugin name. ex: Mysql native password
-
type
Description copied from interface:AuthenticationPluginAuthentication plugin type.- Specified by:
typein interfaceAuthenticationPlugin- Returns:
- authentication plugin type. ex: mysql_native_password
-
initialize
Initialized data.- Specified by:
initializein interfaceAuthenticationPlugin- Parameters:
authenticationData- authentication data (password/token)seed- server provided seedoptions- Connection string options
-
process
public Buffer process(PacketOutputStream out, PacketInputStream in, AtomicInteger sequence) throws IOException, SQLException Process native password plugin authentication. see https://mariadb.com/kb/en/library/authentication-plugin-mysql_native_password/- Specified by:
processin interfaceAuthenticationPlugin- Parameters:
out- out streamin- in streamsequence- packet sequence- Returns:
- response packet
- Throws:
IOException- if socket errorSQLException- if plugin exception
-