Class PemTrustOptions
java.lang.Object
io.vertx.core.net.PemTrustOptions
- All Implemented Interfaces:
TrustOptions, Cloneable
Certificate Authority options configuring certificates based on
Privacy-enhanced Electronic Email (PEM) files. The options is configured with a list of
validating certificates.
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));
- Author:
- Julien Viet, Tim Fox
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorPemTrustOptions(JsonObject json) Create options from JSONPemTrustOptions(PemTrustOptions other) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionaddCertPath(String certPath) Add a certificate pathaddCertValue(Buffer certValue) Add a certificate valuecopy()booleanio.vertx.core.net.impl.KeyStoreHelpergetTrustManagerFactory(Vertx vertx) Create and return the trust manager factory for these options.inthashCode()loadKeyStore(Vertx vertx) Load and return a Java keystore.toJson()Convert to JSONtrustManagerMapper(Vertx vertx) Returns a function that maps SNI server names to aTrustManagerFactoryinstance.
-
Constructor Details
-
PemTrustOptions
public PemTrustOptions()Default constructor -
PemTrustOptions
Copy constructor- Parameters:
other- the options to copy
-
PemTrustOptions
-
-
Method Details
-
toJson
-
getCertPaths
-
addCertPath
Add a certificate path- Parameters:
certPath- the path to add- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
getCertValues
-
addCertValue
Add a certificate value- Parameters:
certValue- the value to add- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
loadKeyStore
-
getTrustManagerFactory
Description copied from interface:TrustOptionsCreate and return the trust manager factory for these options.The returned trust manager factory should be already initialized and ready to use.
- Specified by:
getTrustManagerFactoryin interfaceTrustOptions- Parameters:
vertx- the vertx instance- Returns:
- the trust manager factory
- Throws:
Exception
-
trustManagerMapper
Description copied from interface:TrustOptionsReturns a function that maps SNI server names to aTrustManagerFactoryinstance. The returnedTrustManagerFactorymust 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 returnnullin which caseTrustOptions.getTrustManagerFactory(Vertx)is used as fallback.- Specified by:
trustManagerMapperin interfaceTrustOptions- Parameters:
vertx- the vertx instance- Returns:
- the trustManager
- Throws:
Exception
-
equals
-
hashCode
-
copy
- Specified by:
copyin interfaceTrustOptions- Returns:
- a copy of these options
-
getHelper
-