public interface SecurityContextI
SecurityContextI
interface represents security context that the API will use to setup secure communications with
the server.
This allows the application to provide a KeyStore
object if the application wishes the client to validate
received certificates based on the contents of this keystore. The keystore object provided must have a keystore file loaded and
initialized and also must contain at least one certificate to be considered valid.
Modifier and Type | Method and Description |
---|---|
static SecurityContextI |
create(java.security.KeyStore keyStore)
Static factory method to create a new
SecurityContextI object based on the supplied java.security.KeyStore
object. |
java.security.KeyStore |
getKeyStore() |
java.security.KeyStore getKeyStore()
java.security.KeyStore
object that is contained in this objectstatic SecurityContextI create(java.security.KeyStore keyStore) throws InvalidArgumentException, SecurityException
SecurityContextI
object based on the supplied java.security.KeyStore
object.
A java.security.KeyStore
object that represents a keystore on the file system can be created with the following
code snippet;
char[] password = new char[] {'*', '*', '*', '*'};
KeyStore ks = KeyStore.getInstance("JKS");
try (InputStream keyStoreInStream = new FileInputStream("\\{FileSystemPathToKeyStore}\\{KeystoreFileName.jks}")) {
ks.load(keyStoreInStream, password);
} catch (IOException e) {
}
keyStore
- the java.security.KeyStore
object for the client to use for secure communicationsSecurityContextI
instance wrapping the security detailsInvalidArgumentException
- if the keystore argument is null
SecurityException
- if the keystore is not loaded, not initialized or does not contain any certificates