Using certificate authentication without a password v42.7.3.2
To use certificate authentication without a password:
- Convert the client certificate to DER format.
$ openssl x509 –in postgresql.crt -out postgresql.crt.der -outform der
- Convert the client key to DER format.
$ openssl pkcs8 -topk8 -outform DER -in postgresql.key -out postgresql.key.pk8 –nocrypt
- Copy the client files (
postgresql.crt.der
,postgresql.key.pk8
) and root certificate to the client machine and use the following properties in your Java program to test it:
String url = "jdbc:edb://snvm001:5444/edbstore"; Properties props = new Properties(); props.setProperty("user","enterprisedb"); props.setProperty("ssl","true"); props.setProperty("sslmode","verify-full"); props.setProperty("sslcert","postgresql.crt.der"); props.setProperty("sslkey","postgresql.key.pk8"); props.setProperty("sslrootcert","root.crt");
- Compile the Java program and test it.
$ java -Djavax.net.ssl.trustStore=mystore -classpath .:./edb-jdbc18.jar pg_ssl public