Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MARP-1737: Mailstore connector - Fix compile error in PR & Release #40

Open
wants to merge 1 commit into
base: release/10.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.axonivy.connector.mailstore.constant.Constants;
import com.axonivy.connector.mailstore.enums.StartTLS;

import ch.ivyteam.ivy.ssl.client.restricted.SslClientSettings;

public class SSLContextConfigure {
private static final SSLContextConfigure INSTANCE = new SSLContextConfigure();
private SSLContextConfigure() {}
Expand All @@ -37,16 +39,17 @@ public boolean isStartTLSEnabled(Properties properties) {
|| BooleanUtils.toBoolean(properties.getProperty(StartTLS.REQUIRED.getProperty()));
}

@SuppressWarnings("restriction")
public void addIvyTrustStoreToCurrentContext() throws NoSuchAlgorithmException, KeyStoreException,
CertificateException, IOException, KeyManagementException {
TrustManagerFactory tmFactory = initDefaultTrustManagerFactory();
// Backup default Certificates
X509TrustManager defaultX509CertTM = getFirstX509TrustManagerFromFactory(tmFactory);

TrustStoreFileReader trustStoreFileReader = new TrustStoreFileReader();
try (InputStream trustStoreStream = new FileInputStream(trustStoreFileReader.getTrustFile())) {
KeyStore ivyTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
ivyTrustStore.load(trustStoreStream, trustStoreFileReader.getTrustPassword());
var currentSSLClientSettings = SslClientSettings.instance();
try (InputStream trustStoreStream = new FileInputStream(currentSSLClientSettings.getTrustStoreFile())) {
KeyStore ivyTrustStore = KeyStore.getInstance(currentSSLClientSettings.getTrustStoreType());
ivyTrustStore.load(trustStoreStream, currentSSLClientSettings.getTrustStorePassword());
tmFactory = getDefaultAlgorithm();
tmFactory.init(ivyTrustStore);
X509TrustManager ivyTrustManager = getFirstX509TrustManagerFromFactory(tmFactory);
Expand Down

This file was deleted.

Loading