com.amazon.redshift.ssl

## Class LazyKeyManager

- java.lang.Object
- - com.amazon.redshift.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 and Description
`LazyKeyManager(String certfile, String keyfile, CallbackHandler cbh, boolean defaultfile)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)`
`String` `chooseServerAlias(String keyType, Principal[] issuers, Socket socket)`
`X509Certificate[]` `getCertificateChain(String alias)`
`String[]` `getClientAliases(String keyType, Principal[] issuers)`
`PrivateKey` `getPrivateKey(String alias)`
`String[]` `getServerAliases(String keyType, Principal[] issuers)`
`void` `throwKeyManagerException()` getCertificateChain and getPrivateKey cannot throw exeptions, 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 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` - certfile
  `keyfile` - key file
  `cbh` - callback handler
  `defaultfile` - default file

### Method Detail

#### throwKeyManagerException

    public void throwKeyManagerException()
                                  throws RedshiftException

getCertificateChain and getPrivateKey cannot throw exeptions, therefore any exception is stored in `error` and can be raised by this method.

Throws:
  `RedshiftException` - if any exception is stored in `error` and can be raised

#### chooseClientAlias

    public String chooseClientAlias(String[] keyType,
                                    Principal[] issuers,
                                    Socket socket)

Specified by:
  `chooseClientAlias` in interface `X509KeyManager`

#### chooseServerAlias

    public String chooseServerAlias(String keyType,
                                    Principal[] issuers,
                                    Socket socket)

Specified by:
  `chooseServerAlias` in interface `X509KeyManager`

#### getCertificateChain

    public X509Certificate[] getCertificateChain(String alias)

Specified by:
  `getCertificateChain` in interface `X509KeyManager`

#### getClientAliases

    public String[] getClientAliases(String keyType,
                                     Principal[] issuers)

Specified by:
  `getClientAliases` in interface `X509KeyManager`

#### getPrivateKey

    public PrivateKey getPrivateKey(String alias)

Specified by:
  `getPrivateKey` in interface `X509KeyManager`

#### getServerAliases

    public String[] getServerAliases(String keyType,
                                     Principal[] issuers)

Specified by:
  `getServerAliases` in interface `X509KeyManager`