public class Sha256PasswordPlugin extends Object implements AuthenticationPlugin
Constructor and Description |
---|
Sha256PasswordPlugin() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
encrypt(PublicKey publicKey,
String password,
byte[] seed,
String passwordCharacterEncoding)
Encode password with seed and public key.
|
static PublicKey |
generatePublicKey(byte[] publicKeyBytes)
Read public pem key from String.
|
void |
initialize(String authenticationData,
byte[] seed,
Options options)
Initialization.
|
String |
name()
Authentication plugin name.
|
Buffer |
process(PacketOutputStream out,
PacketInputStream in,
AtomicInteger sequence)
Process SHA 256 password plugin authentication.
|
static PublicKey |
readPublicKeyFromFile(String serverRsaPublicKeyFile)
Read public Key from file.
|
static PublicKey |
readPublicKeyFromSocket(PacketInputStream reader,
AtomicInteger sequence)
Read public Key from socket.
|
String |
type()
Authentication plugin type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mustUseSsl
public static PublicKey readPublicKeyFromFile(String serverRsaPublicKeyFile) throws SQLException
serverRsaPublicKeyFile
- RSA public key fileSQLException
- if cannot read file or file content is not a public key.public static PublicKey readPublicKeyFromSocket(PacketInputStream reader, AtomicInteger sequence) throws SQLException, IOException
reader
- input stream readersequence
- current exchange sequenceSQLException
- if server return an Error packet or public key cannot be parsed.IOException
- if error reading socketpublic static PublicKey generatePublicKey(byte[] publicKeyBytes) throws SQLException
publicKeyBytes
- public key bytes valueSQLException
- if key cannot be parsedpublic static byte[] encrypt(PublicKey publicKey, String password, byte[] seed, String passwordCharacterEncoding) throws SQLException, UnsupportedEncodingException
publicKey
- public keypassword
- passwordseed
- seedpasswordCharacterEncoding
- password encodingSQLException
- if cannot encode passwordUnsupportedEncodingException
- if password encoding is unknownpublic String name()
AuthenticationPlugin
name
in interface AuthenticationPlugin
public String type()
AuthenticationPlugin
type
in interface AuthenticationPlugin
public void initialize(String authenticationData, byte[] seed, Options options)
initialize
in interface AuthenticationPlugin
authenticationData
- authentication data (password/token)seed
- server provided seedoptions
- Connection string optionspublic Buffer process(PacketOutputStream out, PacketInputStream in, AtomicInteger sequence) throws IOException, SQLException
process
in interface AuthenticationPlugin
out
- out streamin
- in streamsequence
- packet sequenceIOException
- if socket errorSQLException
- if plugin exceptionCopyright © 2020 mariadb.com. All rights reserved.