Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PemKeyCertOptions

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

A 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-----

Or contain a non encrypted private key in PKCS1 format wrapped in a PEM block, for example:

-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAlO4gbHeFb/fmbUF/tOJfNPJumJUEqgzAzx8MBXv9Acyw9IRa
...
zJ14Yd+t2fsLYVs2H0gxaA4DW6neCzgY3eKpSU0EBHUCFSXp/1+/
-----END RSA PRIVATE KEY-----

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

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

Keys and certificates 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().readFileBlocking("/mykey.pem");
Buffer cert = vertx.fileSystem().readFileBlocking("/mycert.pem");
options.setPemKeyCertOptions(new PemKeyCertOptions().setKeyValue(key).setCertValue(cert));

Several key/certificate pairs can be used:

HttpServerOptions options = new HttpServerOptions();
options.setPemKeyCertOptions(new PemKeyCertOptions()
   .addKeyPath("/mykey1.pem").addCertPath("/mycert1.pem")
   .addKeyPath("/mykey2.pem").addCertPath("/mycert2.pem"));

Hierarchy

  • PemKeyCertOptions

Index

Constructors

constructor

Methods

getCertPaths

  • getCertPaths(): string[]
  • Set all the paths to the certificates files

    Returns string[]

getCertValues

  • Set all the certificates as a list of buffer

    Returns Buffer[]

getKeyPaths

  • getKeyPaths(): string[]
  • Set all the paths to the keys files

    Returns string[]

getKeyValues

  • Set all the keys as a list of buffer

    Returns Buffer[]

setCertPath

  • Set the path of the first certificate, replacing the previous certificates paths

    Parameters

    • certPath: string

    Returns PemKeyCertOptions

setCertPaths

  • Set all the paths to the certificates files

    Parameters

    • certPaths: string[]

    Returns PemKeyCertOptions

setCertValue

  • Set the first certificate as a buffer, replacing the previous certificates buffers

    Parameters

    Returns PemKeyCertOptions

setCertValues

  • Set all the certificates as a list of buffer

    Parameters

    Returns PemKeyCertOptions

setKeyPath

  • Set the path of the first key file, replacing the keys paths

    Parameters

    • keyPath: string

    Returns PemKeyCertOptions

setKeyPaths

  • Set all the paths to the keys files

    Parameters

    • keyPaths: string[]

    Returns PemKeyCertOptions

setKeyValue

  • Set the first key a a buffer, replacing the previous keys buffers

    Parameters

    Returns PemKeyCertOptions

setKeyValues

  • Set all the keys as a list of buffer

    Parameters

    Returns PemKeyCertOptions

toJson

  • toJson(): {}
  • Returns {}

    • [key: string]: any

Generated using TypeDoc