io.vertx.core.net

## Class PemKeyCertOptions

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

- All Implemented Interfaces:
    KeyCertOptions, Cloneable

      public class PemKeyCertOptions
      extends Object
      implements KeyCertOptions, Cloneable

  Key store options configuring a private key and its certificate based on Privacy-enhanced Electronic Email (PEM) files.

  The key file must contain a non encrypted private key in PKCS8 format wrapped in a PEM block, for example:

       -----BEGIN PRIVATE KEY-----
       MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDV6zPk5WqLwS0a
       ...
       K5xBhtm1AhdnZjx5KfW3BecE
       -----END PRIVATE KEY-----

  The certificate file must contain an X.509 certificate wrapped in a PEM block, for example:

       -----BEGIN CERTIFICATE-----
       MIIDezCCAmOgAwIBAgIEZOI/3TANBgkqhkiG9w0BAQsFADBuMRAwDgYDVQQGEwdV
       ...
       +tmLSvYS39O2nqIzzAUfztkYnUlZmB0l/mKkVqbGJA==
       -----END CERTIFICATE-----

  The key and certificate can either be loaded by Vert.x from the filesystem:

       HttpServerOptions options = new HttpServerOptions();
       options.setPemKeyCertOptions(new PemKeyCertOptions().setKeyPath("/mykey.pem").setCertPath("/mycert.pem"));

  Or directly provided as a buffer:

       Buffer key = vertx.fileSystem().readFileSync("/mykey.pem");
       Buffer cert = vertx.fileSystem().readFileSync("/mycert.pem");
       options.setPemKeyCertOptions(new PemKeyCertOptions().setKeyValue(key).setCertValue(cert));

  Author:
    Julien Viet, Tim Fox

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PemKeyCertOptions()` Default constructor
    `PemKeyCertOptions(JsonObject json)` Create options from JSON
    `PemKeyCertOptions(PemKeyCertOptions other)` Copy constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PemKeyCertOptions` | `clone()`
    `boolean` | `equals(Object o)`
    `String` | `getCertPath()` Get the path to the certificate file
    `Buffer` | `getCertValue()` Get the certificate as a buffer
    `String` | `getKeyPath()` Get the path to the key file
    `Buffer` | `getKeyValue()` Get the key as a buffer
    `int` | `hashCode()`
    `PemKeyCertOptions` | `setCertPath(String certPath)` Set the path to the certificate
    `PemKeyCertOptions` | `setCertValue(Buffer certValue)` Set the certificate as a buffer
    `PemKeyCertOptions` | `setKeyPath(String keyPath)` Set the path to the key file
    `PemKeyCertOptions` | `setKeyValue(Buffer keyValue)` Set the key a a buffer

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

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

- - ### Constructor Detail

    - #### PemKeyCertOptions

          public PemKeyCertOptions()

      Default constructor

    - #### PemKeyCertOptions

          public PemKeyCertOptions(PemKeyCertOptions other)

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

    - #### PemKeyCertOptions

          public PemKeyCertOptions(JsonObject json)

      Create options from JSON
      Parameters:
        `json` - the JSON

  - ### Method Detail

    - #### getKeyPath

          public String getKeyPath()

      Get the path to the key file
      Returns:
        the path to the key file

    - #### setKeyPath

          public PemKeyCertOptions setKeyPath(String keyPath)

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

    - #### getCertPath

          public String getCertPath()

      Get the path to the certificate file
      Returns:
        the path to the certificate file

    - #### getKeyValue

          public Buffer getKeyValue()

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

    - #### setKeyValue

          public PemKeyCertOptions setKeyValue(Buffer keyValue)

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

    - #### setCertPath

          public PemKeyCertOptions setCertPath(String certPath)

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

    - #### getCertValue

          public Buffer getCertValue()

      Get the certificate as a buffer
      Returns:
        the certificate as a buffer

    - #### setCertValue

          public PemKeyCertOptions setCertValue(Buffer certValue)

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

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### clone

          public PemKeyCertOptions clone()

      Specified by:
        `clone` in interface `KeyCertOptions`
      Overrides:
        `clone` in class `Object`
      Returns:
        a copy of these options

Copyright © 2015. All rights reserved.