MySql & Hibernate SSL Connection

2019-07-12 13:09发布

I am using MySql & Hibernate and wish to connect with SSL

I have created truststore.jks (I also have pem files for certificates and keys if they are required, but I'd rather use just the truststore if it is possible)

I have the following connection string

"jdbc:mysql://localhost:3306/mydb?verifyServerCertificate=true&useSSL=true&requireSSL=true"

and I am using

"javax.net.ssl.trustStore"

to set the path to the truststore

I am also using a username and password

it also works using or not using

"javax.net.ssl.trustStorePassword"

and have added

"hibernate.connection.requireSSL" and "hibernate.connection.useSSL"

if I remove the truststore, it still connects fine, but if I leave just the truststore it doesn't work. so how do I know it really is connected by ssl? do I still need the username and password? how do I know the truststore is actually being used?

thanks in advance for helping me keep my hair on my head

0条回答
登录 后发表回答