diff --git a/src/main/java/org/mariadb/jdbc/message/server/OkPacket.java b/src/main/java/org/mariadb/jdbc/message/server/OkPacket.java index 80a543f5a..c670fae66 100644 --- a/src/main/java/org/mariadb/jdbc/message/server/OkPacket.java +++ b/src/main/java/org/mariadb/jdbc/message/server/OkPacket.java @@ -141,6 +141,7 @@ public static OkPacket parse(ReadableByteBuf buf, Context context) { * * @param buf packet buffer * @param context connection context + * @return Ok_Packet object */ public static OkPacket parseWithInfo(ReadableByteBuf buf, Context context) { buf.skip(); // ok header @@ -248,6 +249,11 @@ public long getLastInsertId() { return lastInsertId; } + /** + * Get ok packet info byte array. + * That is usually a string value, but for first Ok_Packet, containing fingerprint info. + * @return info + */ public byte[] getInfo() { return info; } diff --git a/src/main/java/org/mariadb/jdbc/plugin/authentication/standard/ParsecPasswordPluginTool.java b/src/main/java/org/mariadb/jdbc/plugin/authentication/standard/ParsecPasswordPluginTool.java index b2dc6dc72..34dd852ba 100644 --- a/src/main/java/org/mariadb/jdbc/plugin/authentication/standard/ParsecPasswordPluginTool.java +++ b/src/main/java/org/mariadb/jdbc/plugin/authentication/standard/ParsecPasswordPluginTool.java @@ -12,6 +12,15 @@ /** Parsec password plugin utility */ public class ParsecPasswordPluginTool { + /** + * Bouncy Castle implementation to get raw public key from raw private key + * @param rawPrivateKey raw ed25519 private key + * @return raw public key + * @throws SQLException exception + * @throws IOException exception + * @throws InvalidAlgorithmParameterException exception + * @throws NoSuchAlgorithmException exception + */ public static byte[] process(byte[] rawPrivateKey) throws SQLException, IOException, diff --git a/src/main/java/org/mariadb/jdbc/plugin/authentication/standard/SendPamAuthPacket.java b/src/main/java/org/mariadb/jdbc/plugin/authentication/standard/SendPamAuthPacket.java index 17959e63e..9183ab1da 100644 --- a/src/main/java/org/mariadb/jdbc/plugin/authentication/standard/SendPamAuthPacket.java +++ b/src/main/java/org/mariadb/jdbc/plugin/authentication/standard/SendPamAuthPacket.java @@ -27,9 +27,7 @@ public class SendPamAuthPacket implements AuthenticationPlugin { * Initialization. * * @param authenticationData authentication data (password/token) - * @param seed server provided seed * @param conf Connection string options - * @param hostAddress host information */ public SendPamAuthPacket(String authenticationData, Configuration conf) { this.authenticationData = authenticationData; diff --git a/src/main/java/org/mariadb/jdbc/util/timeout/NoOpQueryTimeoutHandler.java b/src/main/java/org/mariadb/jdbc/util/timeout/NoOpQueryTimeoutHandler.java index 6b68e5c9a..d49f76076 100644 --- a/src/main/java/org/mariadb/jdbc/util/timeout/NoOpQueryTimeoutHandler.java +++ b/src/main/java/org/mariadb/jdbc/util/timeout/NoOpQueryTimeoutHandler.java @@ -3,6 +3,9 @@ // Copyright (c) 2015-2024 MariaDB Corporation Ab package org.mariadb.jdbc.util.timeout; +/** + * Default no op query timeout. + */ public class NoOpQueryTimeoutHandler implements QueryTimeoutHandler { public static final NoOpQueryTimeoutHandler INSTANCE = new NoOpQueryTimeoutHandler(); diff --git a/src/main/java/org/mariadb/jdbc/util/timeout/QueryTimeoutHandler.java b/src/main/java/org/mariadb/jdbc/util/timeout/QueryTimeoutHandler.java index 6ea80a287..cbff7c4a7 100644 --- a/src/main/java/org/mariadb/jdbc/util/timeout/QueryTimeoutHandler.java +++ b/src/main/java/org/mariadb/jdbc/util/timeout/QueryTimeoutHandler.java @@ -3,6 +3,9 @@ // Copyright (c) 2015-2024 MariaDB Corporation Ab package org.mariadb.jdbc.util.timeout; +/** + * Query Timeout handler for server that doesn't support query specific timeout + */ public interface QueryTimeoutHandler extends AutoCloseable { QueryTimeoutHandler create(int queryTimeout); diff --git a/src/main/java15/org/mariadb/jdbc/plugin/authentication/standard/ParsecPasswordPluginTool.java b/src/main/java15/org/mariadb/jdbc/plugin/authentication/standard/ParsecPasswordPluginTool.java index ad20976a1..0b581aed6 100644 --- a/src/main/java15/org/mariadb/jdbc/plugin/authentication/standard/ParsecPasswordPluginTool.java +++ b/src/main/java15/org/mariadb/jdbc/plugin/authentication/standard/ParsecPasswordPluginTool.java @@ -9,14 +9,20 @@ import java.sql.SQLException; import java.util.Arrays; -/** Parsec password plugin utility*/ +/** + * Parsec password plugin utility + */ public class ParsecPasswordPluginTool { public static byte[] process(byte[] rawPrivateKey) throws SQLException, IOException, InvalidAlgorithmParameterException, NoSuchAlgorithmException { KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("Ed25519"); - keyPairGenerator.initialize(NamedParameterSpec.ED25519, new StaticSecureRandom(rawPrivateKey)); + keyPairGenerator.initialize(NamedParameterSpec.ED25519, new SecureRandom() { + public void nextBytes(byte[] bytes) { + System.arraycopy(rawPrivateKey, 0, bytes, 0, rawPrivateKey.length); + } + }); // public key in SPKI format; the last 32 bytes are the raw public key byte[] spki = @@ -28,16 +34,4 @@ public static byte[] process(byte[] rawPrivateKey) Arrays.copyOfRange(spki, spki.length - 32, spki.length); return rawPublicKey; } - - private static class StaticSecureRandom extends SecureRandom { - private byte[] privateKey; - - public StaticSecureRandom(byte[] privateKey) { - this.privateKey = privateKey; - } - - public void nextBytes(byte[] bytes) { - System.arraycopy(privateKey, 0, bytes, 0, privateKey.length); - } - } }