Package org.postgresql.ssl
Class LazyKeyManager
- java.lang.Object
-
- org.postgresql.ssl.LazyKeyManager
-
- All Implemented Interfaces:
KeyManager,X509KeyManager
public class LazyKeyManager extends Object implements X509KeyManager
A Key manager that only loads the keys, if necessary.
-
-
Constructor Summary
Constructors Constructor Description LazyKeyManager(String certfile, String keyfile, CallbackHandler cbh, boolean defaultfile)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringchooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)StringchooseServerAlias(String keyType, Principal[] issuers, Socket socket)X509Certificate[]getCertificateChain(String alias)String[]getClientAliases(String keyType, Principal[] issuers)PrivateKeygetPrivateKey(String alias)String[]getServerAliases(String keyType, Principal[] issuers)voidthrowKeyManagerException()getCertificateChain and getPrivateKey cannot throw exeptions, therefore any exception is stored inerrorand can be raised by this method.
-
-
-
Constructor Detail
-
LazyKeyManager
public LazyKeyManager(String certfile, String keyfile, CallbackHandler cbh, boolean defaultfile)
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 Detail
-
throwKeyManagerException
public void throwKeyManagerException() throws PSQLExceptiongetCertificateChain and getPrivateKey cannot throw exeptions, therefore any exception is stored inerrorand can be raised by this method.- Throws:
PSQLException- if any exception is stored inerrorand can be raised
-
chooseClientAlias
public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)
- Specified by:
chooseClientAliasin interfaceX509KeyManager
-
chooseServerAlias
public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
- Specified by:
chooseServerAliasin interfaceX509KeyManager
-
getCertificateChain
public X509Certificate[] getCertificateChain(String alias)
- Specified by:
getCertificateChainin interfaceX509KeyManager
-
getClientAliases
public String[] getClientAliases(String keyType, Principal[] issuers)
- Specified by:
getClientAliasesin interfaceX509KeyManager
-
getPrivateKey
public PrivateKey getPrivateKey(String alias)
- Specified by:
getPrivateKeyin interfaceX509KeyManager
-
getServerAliases
public String[] getServerAliases(String keyType, Principal[] issuers)
- Specified by:
getServerAliasesin interfaceX509KeyManager
-
-