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
JksOptions
orPfxOptions
that 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 KeyStoreOptions
copy()
String
getProvider()
String
getType()
KeyStoreOptions
setAlias(String alias)
Set the alias for a server certificate when the keystore has more than one.KeyStoreOptions
setAliasPassword(String aliasPassword)
Set the password for the server certificate designated byKeyStoreOptionsBase.getAlias()
.KeyStoreOptions
setPassword(String password)
Set the password for the key storeKeyStoreOptions
setPath(String path)
Set the path to the key storeKeyStoreOptions
setProvider(String provider)
Set the store provider.KeyStoreOptions
setType(String type)
Set the store type.KeyStoreOptions
setValue(Buffer value)
Set the key store as a bufferJsonObject
toJson()
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:
getProvider
in classKeyStoreOptionsBase
- Returns:
- the store provider
-
setProvider
public KeyStoreOptions setProvider(String provider)
Set the store provider.- Overrides:
setProvider
in classKeyStoreOptionsBase
- Parameters:
provider
- the type- Returns:
- a reference to this, so the API can be used fluently
-
getType
public String getType()
- Overrides:
getType
in classKeyStoreOptionsBase
- Returns:
- the store type
-
setType
public KeyStoreOptions setType(String type)
Set the store type.- Overrides:
setType
in 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:KeyStoreOptionsBase
Set the password for the key store- Overrides:
setPassword
in 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:KeyStoreOptionsBase
Set the path to the key store- Overrides:
setPath
in 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:KeyStoreOptionsBase
Set the key store as a buffer- Overrides:
setValue
in 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:KeyStoreOptionsBase
Set the alias for a server certificate when the keystore has more than one.- Overrides:
setAlias
in classKeyStoreOptionsBase
- Returns:
- a reference to this, so the API can be used fluently
-
setAliasPassword
public KeyStoreOptions setAliasPassword(String aliasPassword)
Description copied from class:KeyStoreOptionsBase
Set the password for the server certificate designated byKeyStoreOptionsBase.getAlias()
.- Overrides:
setAliasPassword
in classKeyStoreOptionsBase
- Returns:
- a reference to this, so the API can be used fluently
-
copy
public KeyStoreOptions copy()
- Specified by:
copy
in interfaceKeyCertOptions
- Specified by:
copy
in interfaceTrustOptions
- Specified by:
copy
in classKeyStoreOptionsBase
- Returns:
- a copy of these options
-
toJson
public JsonObject toJson()
Convert to JSON- Returns:
- the JSON
-
-