|
39 | 39 |
|
40 | 40 | import javax.net.ssl.HttpsURLConnection;
|
41 | 41 | import javax.net.ssl.SSLContext;
|
42 |
| -import javax.net.ssl.TrustManager; |
43 | 42 |
|
44 |
| -import org.apache.cloudstack.utils.security.SSLUtils; |
45 | 43 | import org.apache.commons.collections.MapUtils;
|
46 | 44 | import org.apache.commons.httpclient.HttpStatus;
|
47 | 45 | import org.apache.commons.io.IOUtils;
|
|
55 | 53 | import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
56 | 54 | import org.apache.http.impl.client.CloseableHttpClient;
|
57 | 55 | import org.apache.http.impl.client.HttpClients;
|
| 56 | +import org.apache.http.ssl.SSLContexts; |
58 | 57 | import org.apache.http.util.EntityUtils;
|
59 | 58 |
|
60 | 59 | import com.cloud.utils.Pair;
|
@@ -120,10 +119,10 @@ private SSLContext getSSLContext() {
|
120 | 119 | String password = "changeit";
|
121 | 120 | defaultKeystore.load(is, password.toCharArray());
|
122 | 121 | }
|
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(); |
127 | 126 | } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException | KeyManagementException e) {
|
128 | 127 | s_logger.error(String.format("Failure getting SSL context for HTTPS downloader, using default SSL context: %s", e.getMessage()), e);
|
129 | 128 | try {
|
|
0 commit comments