public class PemTrustOptions extends Object implements TrustOptions, Cloneable
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().readFileBlocking("/cert.pem");
HttpServerOptions options = new HttpServerOptions();
options.setPemTrustOptions(new PemTrustOptions().addCertValue(cert));
| Constructor and Description |
|---|
PemTrustOptions()
Default constructor
|
PemTrustOptions(JsonObject json)
Create options from JSON
|
PemTrustOptions(PemTrustOptions other)
Copy constructor
|
| Modifier and Type | Method and Description |
|---|---|
PemTrustOptions |
addCertPath(String certPath)
Add a certificate path
|
PemTrustOptions |
addCertValue(Buffer certValue)
Add a certificate value
|
PemTrustOptions |
copy() |
List<String> |
getCertPaths() |
List<Buffer> |
getCertValues() |
TrustManagerFactory |
getTrustManagerFactory(Vertx vertx)
Create and return the trust manager factory for these options.
|
KeyStore |
loadKeyStore(Vertx vertx)
Load and return a Java keystore.
|
JsonObject |
toJson()
Convert to JSON
|
java.util.function.Function<String,TrustManager[]> |
trustManagerMapper(Vertx vertx)
Returns a function that maps SNI server names to a
TrustManagerFactory instance. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwrappublic PemTrustOptions()
public PemTrustOptions(PemTrustOptions other)
other - the options to copypublic PemTrustOptions(JsonObject json)
json - the JSONpublic JsonObject toJson()
public List<String> getCertPaths()
public PemTrustOptions addCertPath(String certPath) throws NullPointerException
certPath - the path to addNullPointerExceptionpublic PemTrustOptions addCertValue(Buffer certValue) throws NullPointerException
certValue - the value to addNullPointerExceptionpublic KeyStore loadKeyStore(Vertx vertx) throws Exception
vertx - the vertx instanceKeyStoreExceptionpublic TrustManagerFactory getTrustManagerFactory(Vertx vertx) throws Exception
TrustOptionsThe returned trust manager factory should be already initialized and ready to use.
getTrustManagerFactory in interface TrustOptionsvertx - the vertx instanceExceptionpublic java.util.function.Function<String,TrustManager[]> trustManagerMapper(Vertx vertx) throws Exception
TrustOptionsTrustManagerFactory instance.
The returned TrustManagerFactory must already be initialized and ready to use.
The mapper is only used when the server has SNI enabled and the client indicated a server name.
The returned function may return null in which case TrustOptions.getTrustManagerFactory(Vertx) is used as fallback.trustManagerMapper in interface TrustOptionsvertx - the vertx instanceExceptionpublic PemTrustOptions copy()
copy in interface TrustOptionsCopyright © 2022 Eclipse. All rights reserved.