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"));
| Modifier and Type | Field and Description |
|---|---|
| private List | |
| private List | |
| private KeyStoreHelper | |
| private List | |
| private List |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | PemKeyCertOptions(JsonObject
the JSON json)
References Deprecated
JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.
Create options from JSON |
| Modifier and Type | Method and Description |
|---|---|
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe path to the certificate file certPath)Add a path to a certificate file |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe certificate to add certValue)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Add a certificate as a buffer |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe path to the key file keyPath)Add a path to a key file |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe key to add keyValue)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Add a key as a buffer |
| public PemKeyCertOptions | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
| public String | |
| public List | Returns: the paths to the certificates filesGet all the paths to the certificates files |
| public Buffer | Returns: the first certificate as a buffer
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Get the first certificate as a buffer |
| public List | Returns: certificates as a list of buffersGet all the certificates as a list of buffer |
| pack-priv KeyStoreHelper | |
| public KeyManagerFactory | getKeyManagerFactory(Vertx
the vertx instance vertx)Implements io. Create and return the key manager factory for these options. |
| public String | |
| public List | |
| public Buffer | Returns: the first key as a buffer
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Get the first key as a buffer |
| public List | |
| private void | |
| public Function | keyManagerFactoryMapper(Vertx vertx)
Overrides default io. Returns a function that maps SNI server names to |
| public Function | keyManagerMapper(Vertx vertx)
Overrides default io. Returns a function that maps SNI server names to |
| public KeyStore | |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe path to the certificate certPath)Set the path of the first certificate, replacing the previous certificates paths |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe paths to the certificates files certPaths)Set all the paths to the certificates files |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe first certificate as a buffer certValue)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Set the first certificate as a buffer, replacing the previous certificates buffers |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe certificates as a list of buffer certValues)Set all the certificates as a list of buffer |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe path to the first key file keyPath)Set the path of the first key file, replacing the keys paths |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe paths to the keys files keyPaths)Set all the paths to the keys files |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlykey as a buffer keyValue)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Set the first key a a buffer, replacing the previous keys buffers |
| public PemKeyCertOptions | Returns: a reference to this, so the API can be used fluentlythe keys as a list of buffer keyValues)Set all the keys as a list of buffer |
| public JsonObject | Returns: the JSON
References Deprecated
JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.
Convert to JSON |
| certPaths | back to summary |
|---|---|
| private List<String> certPaths | |
| certValues | back to summary |
|---|---|
| private List<Buffer> certValues | |
| helper | back to summary |
|---|---|
| private KeyStoreHelper helper | |
| keyPaths | back to summary |
|---|---|
| private List<String> keyPaths | |
| keyValues | back to summary |
|---|---|
| private List<Buffer> keyValues | |
| PemKeyCertOptions | back to summary |
|---|---|
| public PemKeyCertOptions() Default constructor | |
| PemKeyCertOptions | back to summary |
|---|---|
| public PemKeyCertOptions(PemKeyCertOptions other) Copy constructor
| |
| PemKeyCertOptions | back to summary |
|---|---|
| public PemKeyCertOptions(JsonObject json)
References Deprecated
See corresponding docs for further information. Create options from JSON
| |
| addCertPath | back to summary |
|---|---|
| public PemKeyCertOptions addCertPath(String certPath) Add a path to a certificate file
| |
| addCertValue | back to summary |
|---|---|
| public PemKeyCertOptions addCertValue(Buffer certValue)
References Deprecated
See corresponding docs for further information. Add a certificate as a buffer
| |
| addKeyPath | back to summary |
|---|---|
| public PemKeyCertOptions addKeyPath(String keyPath) Add a path to a key file
| |
| addKeyValue | back to summary |
|---|---|
| public PemKeyCertOptions addKeyValue(Buffer keyValue)
References Deprecated
See corresponding docs for further information. Add a key as a buffer
| |
| copy | back to summary |
|---|---|
| public PemKeyCertOptions copy() Implements io.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getCertPath | back to summary |
|---|---|
| public String getCertPath() Get the path to the first certificate file
| |
| getCertPaths | back to summary |
|---|---|
| public List Get all the paths to the certificates files | |
| getCertValue | back to summary |
|---|---|
| public Buffer getCertValue()
References Deprecated
See corresponding docs for further information. Get the first certificate as a buffer
| |
| getCertValues | back to summary |
|---|---|
| public List Get all the certificates as a list of buffer | |
| getHelper | back to summary |
|---|---|
| pack-priv KeyStoreHelper getHelper(Vertx vertx) throws Exception | |
| getKeyManagerFactory | back to summary |
|---|---|
| public KeyManagerFactory getKeyManagerFactory(Vertx vertx) throws Exception Implements io. Doc from io. Create and return the key manager factory for these options. The returned key manager factory should be already initialized and ready to use.
| |
| getKeyPath | back to summary |
|---|---|
| public String getKeyPath() Get the path to the first key file
| |
| getKeyPaths | back to summary |
|---|---|
| public List Get all the paths to the key files | |
| getKeyValue | back to summary |
|---|---|
| public Buffer getKeyValue()
References Deprecated
See corresponding docs for further information. Get the first key as a buffer
| |
| getKeyValues | back to summary |
|---|---|
| public List Get all the keys as a list of buffer | |
| init | back to summary |
|---|---|
| private void init() | |
| keyManagerFactoryMapper | back to summary |
|---|---|
| public Function Overrides default io. Doc from io. Returns a function that maps SNI server names to
The returned function may return
| |
| keyManagerMapper | back to summary |
|---|---|
| public Function Overrides default io. Doc from io. Returns a function that maps SNI server names to
The returned function may return
| |
| loadKeyStore | back to summary |
|---|---|
| public KeyStore loadKeyStore(Vertx vertx) throws Exception Load and return a Java keystore. | |
| setCertPath | back to summary |
|---|---|
| public PemKeyCertOptions setCertPath(String certPath) Set the path of the first certificate, replacing the previous certificates paths
| |
| setCertPaths | back to summary |
|---|---|
| public PemKeyCertOptions setCertPaths(List<String> certPaths) Set all the paths to the certificates files
| |
| setCertValue | back to summary |
|---|---|
| public PemKeyCertOptions setCertValue(Buffer certValue)
References Deprecated
See corresponding docs for further information. Set the first certificate as a buffer, replacing the previous certificates buffers
| |
| setCertValues | back to summary |
|---|---|
| public PemKeyCertOptions setCertValues(List<Buffer> certValues) Set all the certificates as a list of buffer
| |
| setKeyPath | back to summary |
|---|---|
| public PemKeyCertOptions setKeyPath(String keyPath) Set the path of the first key file, replacing the keys paths
| |
| setKeyPaths | back to summary |
|---|---|
| public PemKeyCertOptions setKeyPaths(List<String> keyPaths) Set all the paths to the keys files
| |
| setKeyValue | back to summary |
|---|---|
| public PemKeyCertOptions setKeyValue(Buffer keyValue)
References Deprecated
See corresponding docs for further information. Set the first key a a buffer, replacing the previous keys buffers
| |
| setKeyValues | back to summary |
|---|---|
| public PemKeyCertOptions setKeyValues(List<Buffer> keyValues) Set all the keys as a list of buffer
| |
| toJson | back to summary |
|---|---|
| public JsonObject toJson()
References Deprecated
See corresponding docs for further information. Convert to JSON
| |