Configuring TLS/SSL encryption
- Last Updated: January 17, 2025
- 2 minute read
- DataDirect Connectors
- JDBC
- PostgreSQL 6.0
- Documentation
The following steps outline how to configure TLS/SSL encryption.
Note: Connection
hangs can occur when the driver is configured for SSL and the database server
does not support SSL. You may want to set a login timeout using the LoginTimeout
property to avoid problems when connecting to a server that does not support
SSL.
To configure SSL encryption:
Important: The driver complies with FIPS when FIPS mode is enabled with the
client JVM. See "FIPS (Federal Information Processing Standard)" for more
information.
- Choose the type of encryption for your application.
If you want the driver to encrypt all data, set the EncryptionMethod property to one of the following:
- SSL: Data is encrypted using TLS/SSL. If the database server does not support TLS/SSL, the connection fails and the driver throws an exception.
- requestSSL: Data is encrypted using TLS/SSL. If the database server does not support TLS/SSL, the driver establishes an unencrypted connection.
- Use the CryptoProtocolVersion property to specify acceptable cryptographic protocol versions (for example, TLSv1.3) supported by your server.
- Specify the location and password of the truststore file used for SSL server authentication. Either set the TrustStore and TrustStorePassword properties or their corresponding Java system properties (javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword, respectively).
-
To validate certificates sent by the database server, set the
ValidateServerCertificate property to
true. - Optionally, set the HostNameInCertificate property to a host name to be used to validate the certificate. The HostNameInCertificate property provides additional security against man-in-the-middle (MITM) attacks by ensuring that the server the driver is connecting to is the server that was requested.
-
If your database server is configured for SSL client
authentication, configure your keystore information:
- Specify the location and password of the keystore file. Either set the KeyStore and KeyStorePassword properties or their corresponding Java system properties (javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword, respectively).
- If any key entry in the keystore file is password-protected, set the KeyPassword property to the key password.