Package org.postgresql.ssl
Class LazyKeyManager
java.lang.Object
org.postgresql.ssl.LazyKeyManager
- All Implemented Interfaces:
KeyManager
,X509KeyManager
A Key manager that only loads the keys, if necessary.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CallbackHandler
private X509Certificate[]
private final String
private final boolean
private PSQLException
private PrivateKey
private final String
-
Constructor Summary
ConstructorsConstructorDescriptionLazyKeyManager
(String certfile, String keyfile, CallbackHandler cbh, boolean defaultfile) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionchooseClientAlias
(String[] keyType, Principal[] issuers, Socket socket) chooseServerAlias
(String keyType, Principal[] issuers, Socket socket) getCertificateChain
(String alias) String[]
getClientAliases
(String keyType, Principal[] issuers) getPrivateKey
(String alias) String[]
getServerAliases
(String keyType, Principal[] issuers) private static byte[]
readFileFully
(String path) void
getCertificateChain and getPrivateKey cannot throw exceptions, therefore any exception is stored inerror
and can be raised by this method.
-
Field Details
-
cert
-
key
-
certfile
-
keyfile
-
cbh
-
defaultfile
private final boolean defaultfile -
error
-
-
Constructor Details
-
LazyKeyManager
Constructor. certfile and keyfile can be null, in that case no certificate is presented to the server.- Parameters:
certfile
- certfilekeyfile
- key filecbh
- callback handlerdefaultfile
- default file
-
-
Method Details
-
throwKeyManagerException
getCertificateChain and getPrivateKey cannot throw exceptions, therefore any exception is stored inerror
and can be raised by this method.- Throws:
PSQLException
- if any exception is stored inerror
and can be raised
-
chooseClientAlias
- Specified by:
chooseClientAlias
in interfaceX509KeyManager
-
chooseServerAlias
- Specified by:
chooseServerAlias
in interfaceX509KeyManager
-
getCertificateChain
- Specified by:
getCertificateChain
in interfaceX509KeyManager
-
getClientAliases
- Specified by:
getClientAliases
in interfaceX509KeyManager
-
readFileFully
- Throws:
IOException
-
getPrivateKey
- Specified by:
getPrivateKey
in interfaceX509KeyManager
-
getServerAliases
- Specified by:
getServerAliases
in interfaceX509KeyManager
-