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 CallbackHandlerprivate X509Certificate[]private final Stringprivate final booleanprivate PSQLExceptionprivate PrivateKeyprivate 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) voidgetCertificateChain and getPrivateKey cannot throw exceptions, therefore any exception is stored inerrorand 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 inerrorand can be raised by this method.- Throws:
PSQLException- if any exception is stored inerrorand can be raised
-
chooseClientAlias
- Specified by:
chooseClientAliasin interfaceX509KeyManager
-
chooseServerAlias
- Specified by:
chooseServerAliasin interfaceX509KeyManager
-
getCertificateChain
- Specified by:
getCertificateChainin interfaceX509KeyManager
-
getClientAliases
- Specified by:
getClientAliasesin interfaceX509KeyManager
-
readFileFully
- Throws:
IOException
-
getPrivateKey
- Specified by:
getPrivateKeyin interfaceX509KeyManager
-
getServerAliases
- Specified by:
getServerAliasesin interfaceX509KeyManager
-