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 |
clone() |
PemTrustOptions |
copy() |
boolean |
equals(Object o) |
List<String> |
getCertPaths() |
List<Buffer> |
getCertValues() |
TrustManagerFactory |
getTrustManagerFactory(Vertx vertx)
Create and return the trust manager factory for these options.
|
int |
hashCode() |
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. |
public 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 addNullPointerException
public PemTrustOptions addCertValue(Buffer certValue) throws NullPointerException
certValue
- the value to addNullPointerException
public KeyStore loadKeyStore(Vertx vertx) throws Exception
vertx
- the vertx instanceKeyStore
Exception
public TrustManagerFactory getTrustManagerFactory(Vertx vertx) throws Exception
TrustOptions
The returned trust manager factory should be already initialized and ready to use.
getTrustManagerFactory
in interface TrustOptions
vertx
- the vertx instanceException
public java.util.function.Function<String,TrustManager[]> trustManagerMapper(Vertx vertx) throws Exception
TrustOptions
TrustManagerFactory
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 TrustOptions
vertx
- the vertx instanceException
public PemTrustOptions clone()
clone
in interface TrustOptions
clone
in class Object
public PemTrustOptions copy()
copy
in interface TrustOptions
Copyright © 2023 Eclipse. All rights reserved.