io.vertx.core.net

## Class PemTrustOptions

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

- All Implemented Interfaces:
    TrustOptions, Cloneable

      public class PemTrustOptions
      extends Object
      implements TrustOptions, Cloneable

  Certificate Authority options configuring certificates based on Privacy-enhanced Electronic Email (PEM) files. The options is configured with a list of validating certificates.

  Validating certificates must contain X.509 certificates wrapped in a PEM block:

       -----BEGIN CERTIFICATE-----
       MIIDezCCAmOgAwIBAgIEVmLkwTANBgkqhkiG9w0BAQsFADBuMRAwDgYDVQQGEwdV
       ...
       z5+DuODBJUQst141Jmgq8bS543IU/5apcKQeGNxEyQ==
       -----END CERTIFICATE-----

  The certificates can either be loaded by Vert.x from the filesystem:

       HttpServerOptions options = new HttpServerOptions();
       options.setPemTrustOptions(new PemTrustOptions().addCertPath("/cert.pem"));

  Or directly provided as a buffer:

       Buffer cert = vertx.fileSystem().readFileSync("/cert.pem");
       HttpServerOptions options = new HttpServerOptions();
       options.setPemTrustOptions(new PemTrustOptions().addCertValue(cert));

  Author:
    Julien Viet, Tim Fox

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PemTrustOptions` | `addCertPath(String certPath)` Add a certificate path
    `PemTrustOptions` | `addCertValue(Buffer certValue)` Add a certificate value
    `PemTrustOptions` | `clone()`
    `List<String>` | `getCertPaths()`
    `List<Buffer>` | `getCertValues()`

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

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

- - ### Constructor Detail

    - #### PemTrustOptions

          public PemTrustOptions()

      Default constructor

    - #### PemTrustOptions

          public PemTrustOptions(PemTrustOptions other)

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

    - #### PemTrustOptions

          public PemTrustOptions(JsonObject json)

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

  - ### Method Detail

    - #### getCertPaths

          public List<String> getCertPaths()

      Returns:
        the certificate paths used to locate certificates

    - #### addCertPath

          public PemTrustOptions addCertPath(String certPath)
                                      throws NullPointerException

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

    - #### getCertValues

          public List<Buffer> getCertValues()

      Returns:
        the certificate values

    - #### addCertValue

          public PemTrustOptions addCertValue(Buffer certValue)
                                       throws NullPointerException

      Add a certificate value
      Parameters:
        `certValue` - the value to add
      Returns:
        a reference to this, so the API can be used fluently
      Throws:
        `NullPointerException`

    - #### clone

          public PemTrustOptions clone()

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

Copyright © 2015. All Rights Reserved.