Class LibPQFactory

  • All Implemented Interfaces:
    javax.net.ssl.HostnameVerifier

    public class LibPQFactory
    extends WrappedFactory
    implements javax.net.ssl.HostnameVerifier
    Provide an SSLSocketFactory that is compatible with the libpq behaviour.
    • Constructor Detail

      • LibPQFactory

        public LibPQFactory​(java.util.Properties info)
                     throws PSQLException
        Parameters:
        info - the connection parameters The following parameters are used: sslmode,sslcert,sslkey,sslrootcert,sslhostnameverifier,sslpasswordcallback,sslpassword
        Throws:
        PSQLException - if security error appears when initializing factory
    • Method Detail

      • verify

        public boolean verify​(java.lang.String hostname,
                              javax.net.ssl.SSLSession session)
        Verifies the server certificate according to the libpq rules. The cn attribute of the certificate is matched against the hostname. If the cn attribute starts with an asterisk (*), it will be treated as a wildcard, and will match all characters except a dot (.). This means the certificate will not match subdomains. If the connection is made using an IP address instead of a hostname, the IP address will be matched (without doing any DNS lookups).
        Specified by:
        verify in interface javax.net.ssl.HostnameVerifier
        Parameters:
        hostname - Hostname or IP address of the server.
        session - The SSL session.
        Returns:
        true if the certificate belongs to the server, false otherwise.