Package io.vertx.core.net

## Class KeyStoreOptionsBase

- java.lang.Object
- - io.vertx.core.net.KeyStoreOptionsBase

- All Implemented Interfaces:
    `KeyCertOptions`, `TrustOptions`
  Direct Known Subclasses:
    `JksOptions`, `KeyStoreOptions`, `PfxOptions`

      public abstract class KeyStoreOptionsBase
      extends Object
      implements KeyCertOptions, TrustOptions

  Base class of `KeyStore` based options.
  Author:
    Julien Viet, Tim Fox

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `KeyStoreOptionsBase()` | Default constructor
    `protected` | `KeyStoreOptionsBase​(KeyStoreOptionsBase other)` | Copy constructor

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract KeyStoreOptionsBase` | `copy()` |
    `boolean` | `equals​(Object obj)` |
    `String` | `getAlias()` |
    `String` | `getAliasPassword()` |
    `io.vertx.core.net.impl.KeyStoreHelper` | `getHelper​(Vertx vertx)` |
    `KeyManagerFactory` | `getKeyManagerFactory​(Vertx vertx)` | Create and return the key manager factory for these options.
    `String` | `getPassword()` |
    `String` | `getPath()` | Get the path to the ksy store
    `protected String` | `getProvider()` |
    `TrustManagerFactory` | `getTrustManagerFactory​(Vertx vertx)` | Create and return the trust manager factory for these options.
    `protected String` | `getType()` |
    `Buffer` | `getValue()` | Get the key store as a buffer
    `int` | `hashCode()` |
    `java.util.function.Function<String,​KeyManagerFactory>` | `keyManagerFactoryMapper​(Vertx vertx)` | Returns a function that maps SNI server names to `KeyManagerFactory` instance.
    `KeyStore` | `loadKeyStore​(Vertx vertx)` | Load and return a Java keystore.
    `KeyStoreOptionsBase` | `setAlias​(String alias)` | Set the alias for a server certificate when the keystore has more than one.
    `KeyStoreOptionsBase` | `setAliasPassword​(String aliasPassword)` | Set the password for the server certificate designated by `getAlias()`.
    `KeyStoreOptionsBase` | `setPassword​(String password)` | Set the password for the key store
    `KeyStoreOptionsBase` | `setPath​(String path)` | Set the path to the key store
    `protected KeyStoreOptionsBase` | `setProvider​(String provider)` |
    `protected KeyStoreOptionsBase` | `setType​(String type)` |
    `KeyStoreOptionsBase` | `setValue​(Buffer value)` | Set the key store as a buffer
    `java.util.function.Function<String,​TrustManager[]>` | `trustManagerMapper​(Vertx vertx)` | Returns a function that maps SNI server names to a `TrustManagerFactory` instance.

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

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

- - ### Constructor Detail

    - #### KeyStoreOptionsBase

          protected KeyStoreOptionsBase()

      Default constructor

    - #### KeyStoreOptionsBase

          protected KeyStoreOptionsBase​(KeyStoreOptionsBase other)

      Copy constructor
      Parameters:
        `other` - the options to copy

  - ### Method Detail

    - #### getType

          protected String getType()

    - #### setType

          protected KeyStoreOptionsBase setType​(String type)

    - #### getProvider

          protected String getProvider()

    - #### setProvider

          protected KeyStoreOptionsBase setProvider​(String provider)

    - #### getPassword

          public String getPassword()

      Returns:
        the password for the key store

    - #### setPassword

          public KeyStoreOptionsBase setPassword​(String password)

      Set the password for the key store
      Parameters:
        `password` - the password
      Returns:
        a reference to this, so the API can be used fluently

    - #### getPath

          public String getPath()

      Get the path to the ksy store
      Returns:
        the path

    - #### setPath

          public KeyStoreOptionsBase setPath​(String path)

      Set the path to the key store
      Parameters:
        `path` - the path
      Returns:
        a reference to this, so the API can be used fluently

    - #### getValue

          public Buffer getValue()

      Get the key store as a buffer
      Returns:
        the key store as a buffer

    - #### setValue

          public KeyStoreOptionsBase setValue​(Buffer value)

      Set the key store as a buffer
      Parameters:
        `value` - the key store as a buffer
      Returns:
        a reference to this, so the API can be used fluently

    - #### getAlias

          public String getAlias()

      Returns:
        the alias for a server certificate when the keystore has more than one, or `null`

    - #### setAlias

          public KeyStoreOptionsBase setAlias​(String alias)

      Set the alias for a server certificate when the keystore has more than one.
      Returns:
        a reference to this, so the API can be used fluently

    - #### getAliasPassword

          public String getAliasPassword()

      Returns:
        the password for the server certificate designated by `getAlias()`, or `null`

    - #### setAliasPassword

          public KeyStoreOptionsBase setAliasPassword​(String aliasPassword)

      Set the password for the server certificate designated by `getAlias()`.
      Returns:
        a reference to this, so the API can be used fluently

    - #### getHelper

          public io.vertx.core.net.impl.KeyStoreHelper getHelper​(Vertx vertx)
                                                          throws Exception

      Throws:
        `Exception`

    - #### loadKeyStore

          public KeyStore loadKeyStore​(Vertx vertx)
                                throws Exception

      Load and return a Java keystore.
      Parameters:
        `vertx` - the vertx instance
      Returns:
        the `KeyStore`
      Throws:
        `Exception`

    - #### getKeyManagerFactory

          public KeyManagerFactory getKeyManagerFactory​(Vertx vertx)
                                                 throws Exception

      Description copied from interface: `KeyCertOptions`
      Create and return the key manager factory for these options.

      The returned key manager factory should be already initialized and ready to use.

      Specified by:
        `getKeyManagerFactory` in interface `KeyCertOptions`
      Parameters:
        `vertx` - the vertx instance
      Returns:
        the key manager factory
      Throws:
        `Exception`

    - #### keyManagerFactoryMapper

          public java.util.function.Function<String,​KeyManagerFactory> keyManagerFactoryMapper​(Vertx vertx)
                                                                                              throws Exception

      Description copied from interface: `KeyCertOptions`
      Returns a function that maps SNI server names to `KeyManagerFactory` instance. The returned `KeyManagerFactory` must satisfies these rules:
      - The store private key must match the indicated server name for a null alias.
      - The store certificate chain must match the indicated server name for a null alias.
      The mapper is only used when the server has SNI enabled and the client indicated a server name.

      The returned function may return `null` in which case the default key manager provided by `KeyCertOptions.getKeyManagerFactory(Vertx)` will be used.

      Specified by:
        `keyManagerFactoryMapper` in interface `KeyCertOptions`
      Throws:
        `Exception`

    - #### getTrustManagerFactory

          public TrustManagerFactory getTrustManagerFactory​(Vertx vertx)
                                                     throws Exception

      Description copied from interface: `TrustOptions`
      Create and return the trust manager factory for these options.

      The returned trust manager factory should be already initialized and ready to use.

      Specified by:
        `getTrustManagerFactory` in interface `TrustOptions`
      Parameters:
        `vertx` - the vertx instance
      Returns:
        the trust manager factory
      Throws:
        `Exception`

    - #### trustManagerMapper

          public java.util.function.Function<String,​TrustManager[]> trustManagerMapper​(Vertx vertx)
                                                                                      throws Exception

      Description copied from interface: `TrustOptions`
      Returns a function that maps SNI server names to a `TrustManagerFactory` instance. The returned `TrustManagerFactory` must already be initialized and ready to use. The mapper is only used when the server has SNI enabled and the client indicated a server name.

      The returned function may return `null` in which case `TrustOptions.getTrustManagerFactory(Vertx)` is used as fallback.
      Specified by:
        `trustManagerMapper` in interface `TrustOptions`
      Parameters:
        `vertx` - the vertx instance
      Returns:
        the trustManager
      Throws:
        `Exception`

    - #### copy

          public abstract KeyStoreOptionsBase copy()

      Specified by:
        `copy` in interface `KeyCertOptions`
      Specified by:
        `copy` in interface `TrustOptions`
      Returns:
        a copy of these options

    - #### equals

          public boolean equals​(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`