Package io.vertx.core.net
Class KeyStoreOptions
- java.lang.Object
-
- io.vertx.core.net.KeyStoreOptionsBase
-
- io.vertx.core.net.KeyStoreOptions
-
- All Implemented Interfaces:
KeyCertOptions,TrustOptions
public class KeyStoreOptions extends KeyStoreOptionsBase
Key or trust store options configuring private key and/or certificates based onKeyStore.- when used as a key store, it should point to a store containing a private key and its certificate.
- when used as a trust store, it should point to a store containing a list of trusted certificates.
The store can either be loaded by Vert.x from the filesystem:
HttpServerOptions options = HttpServerOptions.httpServerOptions(); options.setKeyCertOptions(new KeyStoreOptions().setType("JKS").setPath("/mykeystore.jks").setPassword("foo"));Or directly provided as a buffer:Buffer store = vertx.fileSystem().readFileBlocking("/mykeystore.jks"); options.setKeyCertOptions(new KeyStoreOptions().setType("JKS").setValue(store).setPassword("foo"));You can also use specific subclasses
JksOptionsorPfxOptionsthat will set thesetType(java.lang.String)for you:HttpServerOptions options = HttpServerOptions.httpServerOptions(); options.setKeyCertOptions(new JksOptions().setPath("/mykeystore.jks").setPassword("foo"));- Author:
- Julien Viet, Tim Fox
-
-
Constructor Summary
Constructors Constructor Description KeyStoreOptions()Default constructorKeyStoreOptions(JsonObject json)Create options from JSONKeyStoreOptions(KeyStoreOptions other)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyStoreOptionscopy()StringgetProvider()StringgetType()KeyStoreOptionssetAlias(String alias)Set the alias for a server certificate when the keystore has more than one.KeyStoreOptionssetAliasPassword(String aliasPassword)Set the password for the server certificate designated byKeyStoreOptionsBase.getAlias().KeyStoreOptionssetPassword(String password)Set the password for the key storeKeyStoreOptionssetPath(String path)Set the path to the key storeKeyStoreOptionssetProvider(String provider)Set the store provider.KeyStoreOptionssetType(String type)Set the store type.KeyStoreOptionssetValue(Buffer value)Set the key store as a bufferJsonObjecttoJson()Convert to JSON-
Methods inherited from class io.vertx.core.net.KeyStoreOptionsBase
equals, getAlias, getAliasPassword, getHelper, getKeyManagerFactory, getPassword, getPath, getTrustManagerFactory, getValue, hashCode, keyManagerFactoryMapper, loadKeyStore, trustManagerMapper
-
-
-
-
Constructor Detail
-
KeyStoreOptions
public KeyStoreOptions()
Default constructor
-
KeyStoreOptions
public KeyStoreOptions(KeyStoreOptions other)
Copy constructor- Parameters:
other- the options to copy
-
KeyStoreOptions
public KeyStoreOptions(JsonObject json)
Create options from JSON- Parameters:
json- the JSON
-
-
Method Detail
-
getProvider
public String getProvider()
- Overrides:
getProviderin classKeyStoreOptionsBase- Returns:
- the store provider
-
setProvider
public KeyStoreOptions setProvider(String provider)
Set the store provider.- Overrides:
setProviderin classKeyStoreOptionsBase- Parameters:
provider- the type- Returns:
- a reference to this, so the API can be used fluently
-
getType
public String getType()
- Overrides:
getTypein classKeyStoreOptionsBase- Returns:
- the store type
-
setType
public KeyStoreOptions setType(String type)
Set the store type.- Overrides:
setTypein classKeyStoreOptionsBase- Parameters:
type- the type- Returns:
- a reference to this, so the API can be used fluently
-
setPassword
public KeyStoreOptions setPassword(String password)
Description copied from class:KeyStoreOptionsBaseSet the password for the key store- Overrides:
setPasswordin classKeyStoreOptionsBase- Parameters:
password- the password- Returns:
- a reference to this, so the API can be used fluently
-
setPath
public KeyStoreOptions setPath(String path)
Description copied from class:KeyStoreOptionsBaseSet the path to the key store- Overrides:
setPathin classKeyStoreOptionsBase- Parameters:
path- the path- Returns:
- a reference to this, so the API can be used fluently
-
setValue
public KeyStoreOptions setValue(Buffer value)
Description copied from class:KeyStoreOptionsBaseSet the key store as a buffer- Overrides:
setValuein classKeyStoreOptionsBase- Parameters:
value- the key store as a buffer- Returns:
- a reference to this, so the API can be used fluently
-
setAlias
public KeyStoreOptions setAlias(String alias)
Description copied from class:KeyStoreOptionsBaseSet the alias for a server certificate when the keystore has more than one.- Overrides:
setAliasin classKeyStoreOptionsBase- Returns:
- a reference to this, so the API can be used fluently
-
setAliasPassword
public KeyStoreOptions setAliasPassword(String aliasPassword)
Description copied from class:KeyStoreOptionsBaseSet the password for the server certificate designated byKeyStoreOptionsBase.getAlias().- Overrides:
setAliasPasswordin classKeyStoreOptionsBase- Returns:
- a reference to this, so the API can be used fluently
-
copy
public KeyStoreOptions copy()
- Specified by:
copyin interfaceKeyCertOptions- Specified by:
copyin interfaceTrustOptions- Specified by:
copyin classKeyStoreOptionsBase- Returns:
- a copy of these options
-
toJson
public JsonObject toJson()
Convert to JSON- Returns:
- the JSON
-
-