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(@Nullable String certfile, @Nullable String keyfile, CallbackHandler cbh, boolean defaultfile)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `@Nullable String`
  `chooseClientAlias(String[] keyType, Principal @Nullable [] issuers, @Nullable Socket socket)`
  `@Nullable String`
  `chooseServerAlias(String keyType, Principal @Nullable [] issuers, @Nullable Socket socket)`
  `X509Certificate @Nullable []`
  `getCertificateChain(String alias)`
  `String @Nullable []`
  `getClientAliases(String keyType, Principal @Nullable [] issuers)`
  `@Nullable PrivateKey`
  `getPrivateKey(String alias)`
  `String @Nullable []`
  `getServerAliases(String keyType, Principal @Nullable [] issuers)`
  `void`
  `throwKeyManagerException()`
  getCertificateChain and getPrivateKey cannot throw exceptions, therefore any exception is stored in `error` and can be raised by this method.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LazyKeyManager

    public LazyKeyManager(@Nullable String certfile, @Nullable 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` - certfile
      `keyfile` - key file
      `cbh` - callback handler
      `defaultfile` - default file

- ## Method Details

  - ### throwKeyManagerException

    public void throwKeyManagerException() throws PSQLException
    getCertificateChain and getPrivateKey cannot throw exceptions, therefore any exception is stored in `error` and can be raised by this method.
    Throws:
      `PSQLException` - if any exception is stored in `error` and can be raised

  - ### chooseClientAlias

    public @Nullable String chooseClientAlias(String[] keyType, Principal @Nullable [] issuers, @Nullable Socket socket)
    Specified by:
      `chooseClientAlias` in interface `X509KeyManager`

  - ### chooseServerAlias

    public @Nullable String chooseServerAlias(String keyType, Principal @Nullable [] issuers, @Nullable Socket socket)
    Specified by:
      `chooseServerAlias` in interface `X509KeyManager`

  - ### getCertificateChain

    public X509Certificate @Nullable [] getCertificateChain(String alias)
    Specified by:
      `getCertificateChain` in interface `X509KeyManager`

  - ### getClientAliases

    public String @Nullable [] getClientAliases(String keyType, Principal @Nullable [] issuers)
    Specified by:
      `getClientAliases` in interface `X509KeyManager`

  - ### getPrivateKey

    public @Nullable PrivateKey getPrivateKey(String alias)
    Specified by:
      `getPrivateKey` in interface `X509KeyManager`

  - ### getServerAliases

    public String @Nullable [] getServerAliases(String keyType, Principal @Nullable [] issuers)
    Specified by:
      `getServerAliases` in interface `X509KeyManager`