Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
None
-
None
-
On premise-Windows
Description
Tried to connect java with MariaDB 2-Way SSL Authentication.
I created CA, Server and client certificate using below mentioned link:
https://mariadb.com/docs/server/security/data-in-transit-encryption/create-self-signed-certificates-keys-openssl/
Used this below steps to format the client certificate:
Convert client cert to PkCS12 format:
Command: openssl pkcs12 -export -in client-cert.pem -inkey client-key.pem -name "Maria -passout pass:mypassword -out client-keystore.p12
Convert PKCS12 file to keystore:
Command: keytool -importkeystore -srckeystore client-keystore.p12 -srcstoretype pkcs12 -srcstorepass mypassword -destkeystore keystore -deststoretype JKS -deststorepass mypassword
MariaDB driver version: 3.4.1
Case 1:
Java connection string:
jdbc:mariadb://localhost:3307/mysql?user=user&password=pwd&sslMode=VERIFY_CA&serverSslCert=C:\\ca-cert.pem&keyStore=C:
keystore&keyStorePassword=mypassword
Case 2:
Also tried to import ca-cert.pem file to JRE\lib\security\cacerts file.
Used this below url for this case:
jdbc:mariadb://localhost:3307/mysql?user=user&password=pwd&sslMode=VERIFY_CA&keyStore=C:
keystore&keyStorePassword=mypassword
Exception occurred in both the case:
Caused by: javax.net.ssl.SSLException: readHandshakeRecord
Suppressed: java.net.SocketException: An established connection was aborted by the software in your host machine
How to create CA, server, client certificate in MariaDB. And how to convert client certificate to keystore. What is the extract connection string to connect with Java?
Can please provide solution for this issue?