acme gives you the whole cert chain as List<X509Certificate>
.
How do I create the SSLEngine
from that cert chain?
(I would like ideally to skip the whole keystore thing or populate a keystore dynamically to be read from at runtime).
EDIT: I have the following code but
- not sure what alias should be filled in with
- not sure why I need a password
- not sure if I should use the variable defaultType
- Is JKS ok for a 509Cert
do I want "TLSv1.2"
String defaultType = KeyStore.getDefaultType(); KeyStore ks = KeyStore.getInstance("JKS"); ks.setCertificateEntry(alias, cert); SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); //****************Server side specific********************* // KeyManager's decide which key material to use. KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(ks, passphrase); sslContext.init(kmf.getKeyManagers(), null, null); //****************Server side specific********************* SSLEngine engine = sslContext.createSSLEngine(); engine.setUseClientMode(false); return engine;