public class PemKeyCertOptions extends Object implements KeyCertOptions, Cloneable
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));
Constructor and Description |
---|
PemKeyCertOptions()
Default constructor
|
PemKeyCertOptions(JsonObject json)
Create options from JSON
|
PemKeyCertOptions(PemKeyCertOptions other)
Copy constructor
|
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
|
public PemKeyCertOptions()
public PemKeyCertOptions(PemKeyCertOptions other)
other
- the options to copypublic PemKeyCertOptions(JsonObject json)
json
- the JSONpublic String getKeyPath()
public PemKeyCertOptions setKeyPath(String keyPath)
keyPath
- the path to the key filepublic String getCertPath()
public Buffer getKeyValue()
public PemKeyCertOptions setKeyValue(Buffer keyValue)
keyValue
- key as a bufferpublic PemKeyCertOptions setCertPath(String certPath)
certPath
- the path to the certificatepublic Buffer getCertValue()
public PemKeyCertOptions setCertValue(Buffer certValue)
certValue
- the certificate as a bufferpublic PemKeyCertOptions clone()
clone
in interface KeyCertOptions
clone
in class Object
Copyright © 2015. All Rights Reserved.