Configure CADP for Java to use Remote Keystore
This article explains how to configure CADP for Java to use a remote Java keystore. A remote keystore is necessary for supporting TLS in scenarios where an application can't directly access the disk. One such example is running User Defined Functions (UDFs) as a Function as A Service (FAAS) in a cloud environment. More examples of such functions are AWS Lambda, Azure, and GCP Functions.
The following diagram shows how CADP for Java accesses remote keystore using URL.
The following code snippet shows how to configure CADP for Java for remote Java keystore:
InputStream inputStream = null;
KeyStore keystore = null;
try{
inputStream = new URL(remoteKeystoreURL).openStream();
keystore = KeyStore.getInstance("JKS");
keystore.load(inputStream, keystorePassword.toCharArray());
}
catch (Exception e){
System.out.println("The Cause is " + e.getMessage() + ".");
throw e;
}
finally{
if (inputStream != null)inputStream.close();
}
Security.addProvider(new IngrianProvider.Builder().addKeyStore(keystore).build());
Reference
The remote keystore sample is available on Github.