Class NativePasswordPlugin
- java.lang.Object
-
- org.mariadb.jdbc.plugin.authentication.standard.NativePasswordPlugin
-
- All Implemented Interfaces:
AuthenticationPlugin
public class NativePasswordPlugin extends Object implements AuthenticationPlugin
-
-
Constructor Summary
Constructors Constructor Description NativePasswordPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]encryptPassword(CharSequence password, byte[] seed)Encrypts a password.voidinitialize(String authenticationData, byte[] seed, Configuration conf)Initialized data.org.mariadb.jdbc.client.ReadableByteBufprocess(PacketWriter out, PacketReader in, Context context)Process native password plugin authentication.Stringtype()Authentication plugin type.
-
-
-
Field Detail
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
encryptPassword
public static byte[] encryptPassword(CharSequence password, byte[] seed)
Encrypts a password.protocol for authentication is like this:
- Server sends a random array of bytes (the seed)
- client makes a sha1 digest of the password
- client hashes the output of 2
- client digests the seed
- client updates the digest with the output from 3
- an xor of the output of 5 and 2 is sent to server
- server does the same thing and verifies that the scrambled passwords match
- Parameters:
password- the password to encryptseed- the seed to use- Returns:
- a scrambled password
-
type
public String type()
Description copied from interface:AuthenticationPluginAuthentication plugin type.- Specified by:
typein interfaceAuthenticationPlugin- Returns:
- authentication plugin type. ex: mysql_native_password
-
initialize
public void initialize(String authenticationData, byte[] seed, Configuration conf)
Initialized data.- Specified by:
initializein interfaceAuthenticationPlugin- Parameters:
authenticationData- authentication data (password/token)seed- server provided seedconf- Connection string options
-
process
public org.mariadb.jdbc.client.ReadableByteBuf process(PacketWriter out, PacketReader in, Context context) throws IOException
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 streamcontext- connection context- Returns:
- response packet
- Throws:
IOException- if socket error
-
-