Top Description Fields Constructors Methods
io.vertx.core.net

public Class PemTrustOptions

extends Object
implements TrustOptions, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, io.vertx.core.net.TrustOptions
Annotations
@DataObject
@JsonGen
publicConverter:false
Imports
io.vertx.codegen.annotations.DataObject, io.vertx.codegen.json.annotations.JsonGen, io.vertx.core.Vertx, io.vertx.core.buffer.Buffer, io.vertx.core.impl.Arguments, .VertxInternal, io.vertx.core.json.JsonObject, io.vertx.core.net.impl.KeyStoreHelper, javax.net.ssl.TrustManager, .TrustManagerFactory, java.security.KeyStore, java.util.ArrayList, .List, .Objects, java.util.function.Function, java.util.stream.Stream

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));
Authors
Julien Viet, Tim Fox

Field Summary

Modifier and TypeField and Description
private ArrayList<String>
private ArrayList<Buffer>
private KeyStoreHelper

Constructor Summary

AccessConstructor and Description
public
PemTrustOptions()

Default constructor

public
PemTrustOptions(PemTrustOptions
the options to copy
other
)

Copy constructor

public
PemTrustOptions(JsonObject
the JSON
json
)
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Create options from JSON

Method Summary

Modifier and TypeMethod and Description
public PemTrustOptions

Returns:

a reference to this, so the API can be used fluently
addCertPath
(String
the path to add
certPath
)

Add a certificate path

public PemTrustOptions

Returns:

a reference to this, so the API can be used fluently
addCertValue
(Buffer
the value to add
certValue
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Add a certificate value

public PemTrustOptions
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public List<String>

Returns:

the certificate paths used to locate certificates
getCertPaths
()

public List<Buffer>

Returns:

the certificate values
getCertValues
()

pack-priv KeyStoreHelper
public TrustManagerFactory
getTrustManagerFactory(Vertx
the vertx instance
vertx
)

Implements io.vertx.core.net.TrustOptions.getTrustManagerFactory.

Create and return the trust manager factory for these options.

public KeyStore

Returns:

the KeyStore
loadKeyStore
(Vertx
the vertx instance
vertx
)

Load and return a Java keystore.

public JsonObject

Returns:

the JSON
toJson
()
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Convert to JSON

public Function<String, TrustManager[]>
trustManagerMapper(Vertx
the vertx instance
vertx
)

Implements io.vertx.core.net.TrustOptions.trustManagerMapper.

Returns a function that maps SNI server names to a TrustManagerFactory instance.

Inherited from java.lang.Object:
clonefinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

certPathsback to summary
private ArrayList<String> certPaths
certValuesback to summary
private ArrayList<Buffer> certValues
helperback to summary
private KeyStoreHelper helper

Constructor Detail

PemTrustOptionsback to summary
public PemTrustOptions()

Default constructor

PemTrustOptionsback to summary
public PemTrustOptions(PemTrustOptions other)

Copy constructor

Parameters
other:PemTrustOptions

the options to copy

PemTrustOptionsback to summary
public PemTrustOptions(JsonObject json)

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create options from JSON

Parameters
json:JsonObject

the JSON

Method Detail

addCertPathback to summary
public PemTrustOptions addCertPath(String certPath) throws NullPointerException

Add a certificate path

Parameters
certPath:String

the path to add

Returns:PemTrustOptions

a reference to this, so the API can be used fluently

addCertValueback to summary
public PemTrustOptions addCertValue(Buffer certValue) throws NullPointerException

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Add a certificate value

Parameters
certValue:Buffer

the value to add

Returns:PemTrustOptions

a reference to this, so the API can be used fluently

copyback to summary
public PemTrustOptions copy()

Implements io.vertx.core.net.TrustOptions.copy.

Returns:PemTrustOptions

Doc from io.vertx.core.net.TrustOptions.copy.

a copy of these options

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

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.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getCertPathsback to summary
public List<String> getCertPaths()
Returns:List<String>

the certificate paths used to locate certificates

getCertValuesback to summary
public List<Buffer> getCertValues()
Returns:List<Buffer>

the certificate values

getHelperback to summary
pack-priv KeyStoreHelper getHelper(Vertx vertx) throws Exception
getTrustManagerFactoryback to summary
public TrustManagerFactory getTrustManagerFactory(Vertx vertx) throws Exception

Implements io.vertx.core.net.TrustOptions.getTrustManagerFactory.

Doc from io.vertx.core.net.TrustOptions.getTrustManagerFactory.

Create and return the trust manager factory for these options.

The returned trust manager factory should be already initialized and ready to use.

Parameters
vertx:Vertx

the vertx instance

Returns:TrustManagerFactory

the trust manager factory

Annotations
@Override
loadKeyStoreback to summary
public KeyStore loadKeyStore(Vertx vertx) throws Exception

Load and return a Java keystore.

Parameters
vertx:Vertx

the vertx instance

Returns:KeyStore

the KeyStore

toJsonback to summary
public JsonObject toJson()

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Convert to JSON

Returns:JsonObject

the JSON

trustManagerMapperback to summary
public Function<String, TrustManager[]> trustManagerMapper(Vertx vertx) throws Exception

Implements io.vertx.core.net.TrustOptions.trustManagerMapper.

Doc from io.vertx.core.net.TrustOptions.trustManagerMapper.

Returns a function that maps SNI server names to a 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 getTrustManagerFactory(Vertx) is used as fallback.

Parameters
vertx:Vertx

the vertx instance

Returns:Function<String, TrustManager[]>

the trustManager

Annotations
@Override