Package org.postgresql.ssl
Class LibPQFactory
- java.lang.Object
-
- javax.net.SocketFactory
-
- javax.net.ssl.SSLSocketFactory
-
- org.postgresql.ssl.WrappedFactory
-
- org.postgresql.ssl.LibPQFactory
-
- Direct Known Subclasses:
LibPQFactory
public class LibPQFactory extends WrappedFactory
Provide an SSLSocketFactory that is compatible with the libpq behaviour.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLibPQFactory.ConsoleCallbackHandlerA CallbackHandler that reads the password from the console or returns the password given to its constructor.
-
Field Summary
Fields Modifier and Type Field Description (package private) booleandefaultfile(package private) javax.net.ssl.KeyManagerkm-
Fields inherited from class org.postgresql.ssl.WrappedFactory
factory
-
-
Constructor Summary
Constructors Constructor Description LibPQFactory(java.util.Properties info)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static booleanendsWithIgnoreCase(java.lang.String value, java.lang.String suffix)Case-insensitiveString.endsWith(String), so.PEMand.pemmap to the same format on case-insensitive filesystems.private javax.security.auth.callback.CallbackHandlergetCallbackHandler(java.util.Properties info)private java.lang.StringgetCertFilePath(java.lang.String defaultdir, java.util.Properties info)private voidinitP12(java.lang.String sslkeyfile, java.util.Properties info)private voidinitPEM(java.lang.String sslKeyFile, java.lang.String defaultdir, java.util.Properties info)private voidinitPk8(java.lang.String sslkeyfile, java.lang.String defaultdir, java.util.Properties info)private voidinitPk8OrPem(java.lang.String sslkeyfile, java.lang.String defaultdir, java.util.Properties info)voidthrowKeyManagerException()Propagates any exception fromLazyKeyManager.-
Methods inherited from class org.postgresql.ssl.WrappedFactory
createSocket, createSocket, createSocket, createSocket, createSocket, getDefaultCipherSuites, getSupportedCipherSuites
-
-
-
-
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
-
getCallbackHandler
private javax.security.auth.callback.CallbackHandler getCallbackHandler(java.util.Properties info) throws PSQLException- Throws:
PSQLException
-
getCertFilePath
private java.lang.String getCertFilePath(java.lang.String defaultdir, java.util.Properties info)
-
initPk8
private void initPk8(java.lang.String sslkeyfile, java.lang.String defaultdir, java.util.Properties info) throws PSQLException- Throws:
PSQLException
-
initP12
private void initP12(java.lang.String sslkeyfile, java.util.Properties info) throws PSQLException- Throws:
PSQLException
-
endsWithIgnoreCase
private static boolean endsWithIgnoreCase(java.lang.String value, java.lang.String suffix)Case-insensitiveString.endsWith(String), so.PEMand.pemmap to the same format on case-insensitive filesystems. Returnsfalsewhenvalueis shorter thansuffix.
-
initPk8OrPem
private void initPk8OrPem(java.lang.String sslkeyfile, java.lang.String defaultdir, java.util.Properties info) throws PSQLException- Throws:
PSQLException
-
initPEM
private void initPEM(java.lang.String sslKeyFile, java.lang.String defaultdir, java.util.Properties info) throws PSQLException- Throws:
PSQLException
-
throwKeyManagerException
public void throwKeyManagerException() throws PSQLExceptionPropagates any exception fromLazyKeyManager.- Throws:
PSQLException- if there is an exception to propagate
-
-