Package org.eclipse.hono.config
Class KeyLoader
java.lang.Object
org.eclipse.hono.config.KeyLoader
A utility class for loading keys from files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic KeyLoader
Creates a new loader for a key store.static KeyLoader
fromKeyStore
(io.vertx.core.Vertx vertx, String keyStorePath, char[] password) Creates a new loader for a key store.Gets the certificate chain.Gets the private key.Gets the public key.
-
Method Details
-
getPrivateKey
Gets the private key.- Returns:
- The private key, may be
null
-
getCertificateChain
Gets the certificate chain.- Returns:
- The chain of
null
if no certificates have been loaded.
-
getPublicKey
Gets the public key.- Returns:
- The public key or
null
if not set.
-
fromKeyStore
public static KeyLoader fromKeyStore(io.vertx.core.Vertx vertx, String keyStorePath, char[] password) Creates a new loader for a key store.- Parameters:
vertx
- The vertx instance to use for loading the key store.keyStorePath
- The absolute path to the key store to load keys from.password
- The password required for accessing the key store.- Returns:
- The loader.
- Throws:
NullPointerException
- if vertx or key store path arenull
.IllegalArgumentException
- if the key store does not exist.
-
fromFiles
Creates a new loader for a key store.- Parameters:
vertx
- The vertx instance to use for loading the key store.keyPath
- The absolute path to the PEM file containing the private key.certPath
- The absolute path to the PEM file containing the certificate (chain).- Returns:
- The loader.
- Throws:
NullPointerException
- if vertx isnull
.IllegalArgumentException
- if any of the files could not be loaded. Reasons might be things like missing, empty or malformed files.
-