/** * Creates {@link SSLContext} from the provided configuration. * * @param sslConfig the ssl configuration * @return a built {@link SSLContext} * @throws IllegalStateException in case of a problem; will wrap either an instance of {@link IOException} or * a {@link GeneralSecurityException} */ public static SSLContext create(Config sslConfig) { return new SSLContextBuilder().privateKeyConfig(KeyConfig.create(sslConfig.get("private-key"))) .sessionCacheSize(sslConfig.get("session-cache-size").asInt().orElse(0)) .sessionTimeout(sslConfig.get("session-timeout").asInt().orElse(0)) .trustConfig(KeyConfig.create(sslConfig.get("trust"))) .build(); }