Skip to content
Snippets Groups Projects
Commit 39a35ff3 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-3322 init trust manager factory

parent d722ac58
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ import java.security.cert.CertificateFactory;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import javax.net.ssl.TrustManagerFactory;
import org.apache.commons.io.IOUtils;
import org.eclipse.microprofile.config.inject.ConfigProperty;
......@@ -43,6 +44,8 @@ class MongodbCertificateLoader {
try {
var trustStore = initKeyStore();
trustStore.setCertificateEntry("ca", generateCertificate());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(trustStore);
return trustStore;
} catch (Exception e) {
throw new TechnicalException("Error building KeyStore", e);
......@@ -52,7 +55,7 @@ class MongodbCertificateLoader {
KeyStore initKeyStore() {
try {
var trustStore = KeyStore.getInstance("pkcs12");
trustStore.load(null, null);
trustStore.load(null);
return trustStore;
} catch (Exception e) {
throw new TechnicalException("Error init KeyStore", e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment