Skip to content

Commit e5326d7

Browse files
committed
DirectDownload: drop HttpsMultiTrustManager
1 parent 3c00d68 commit e5326d7

File tree

2 files changed

+5
-108
lines changed

2 files changed

+5
-108
lines changed

core/src/main/java/org/apache/cloudstack/direct/download/HttpsDirectTemplateDownloader.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939

4040
import javax.net.ssl.HttpsURLConnection;
4141
import javax.net.ssl.SSLContext;
42-
import javax.net.ssl.TrustManager;
4342

44-
import org.apache.cloudstack.utils.security.SSLUtils;
4543
import org.apache.commons.collections.MapUtils;
4644
import org.apache.commons.httpclient.HttpStatus;
4745
import org.apache.commons.io.IOUtils;
@@ -55,6 +53,7 @@
5553
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
5654
import org.apache.http.impl.client.CloseableHttpClient;
5755
import org.apache.http.impl.client.HttpClients;
56+
import org.apache.http.ssl.SSLContexts;
5857
import org.apache.http.util.EntityUtils;
5958

6059
import com.cloud.utils.Pair;
@@ -120,10 +119,10 @@ private SSLContext getSSLContext() {
120119
String password = "changeit";
121120
defaultKeystore.load(is, password.toCharArray());
122121
}
123-
TrustManager[] tm = HttpsMultiTrustManager.getTrustManagersFromKeyStores(customKeystore, defaultKeystore);
124-
SSLContext sslContext = SSLUtils.getSSLContext();
125-
sslContext.init(null, tm, null);
126-
return sslContext;
122+
return SSLContexts.custom()
123+
.loadTrustMaterial(customKeystore, null)
124+
.loadTrustMaterial(defaultKeystore, null)
125+
.build();
127126
} catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException | KeyManagementException e) {
128127
s_logger.error(String.format("Failure getting SSL context for HTTPS downloader, using default SSL context: %s", e.getMessage()), e);
129128
try {

core/src/main/java/org/apache/cloudstack/direct/download/HttpsMultiTrustManager.java

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)