diff --git a/lib/src/main/java/org/sonarsource/scanner/lib/internal/http/OkHttpClientFactory.java b/lib/src/main/java/org/sonarsource/scanner/lib/internal/http/OkHttpClientFactory.java index 3c10f7e9..e067c837 100644 --- a/lib/src/main/java/org/sonarsource/scanner/lib/internal/http/OkHttpClientFactory.java +++ b/lib/src/main/java/org/sonarsource/scanner/lib/internal/http/OkHttpClientFactory.java @@ -39,11 +39,11 @@ import okhttp3.JavaNetCookieJar; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; +import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonarsource.scanner.lib.ScannerProperties; import org.sonarsource.scanner.lib.internal.http.ssl.CertificateStore; -import org.sonarsource.scanner.lib.internal.http.ssl.SonarBouncyCastlePKCS12Provider; import org.sonarsource.scanner.lib.internal.http.ssl.SslConfig; import static java.lang.Integer.parseInt; @@ -186,12 +186,12 @@ private static SSLFactory configureSsl(SslConfig sslConfig) { } var trustStoreConfig = sslConfig.getTrustStore(); if (trustStoreConfig != null && Files.exists(trustStoreConfig.getPath())) { - Security.addProvider(new SonarBouncyCastlePKCS12Provider()); + Security.addProvider(new BouncyCastleProvider()); KeyStore trustStore = KeyStoreUtils.loadKeyStore( trustStoreConfig.getPath(), trustStoreConfig.getKeyStorePassword().toCharArray(), trustStoreConfig.getKeyStoreType(), - SonarBouncyCastlePKCS12Provider.NAME); + BouncyCastleProvider.PROVIDER_NAME); sslFactoryBuilder.withTrustMaterial(trustStore); } return sslFactoryBuilder.build(); diff --git a/lib/src/main/java/org/sonarsource/scanner/lib/internal/http/ssl/SonarBouncyCastlePKCS12Provider.java b/lib/src/main/java/org/sonarsource/scanner/lib/internal/http/ssl/SonarBouncyCastlePKCS12Provider.java deleted file mode 100644 index b93b9aa7..00000000 --- a/lib/src/main/java/org/sonarsource/scanner/lib/internal/http/ssl/SonarBouncyCastlePKCS12Provider.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarScanner Java Library - * Copyright (C) 2011-2024 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonarsource.scanner.lib.internal.http.ssl; - -import java.security.Provider; -import org.bouncycastle.jcajce.provider.keystore.pkcs12.PKCS12KeyStoreSpi.BCPKCS12KeyStore; - -public class SonarBouncyCastlePKCS12Provider extends Provider { - - public static final String NAME = "SONAR-BC"; - - public SonarBouncyCastlePKCS12Provider() { - super(NAME, "1.0", "BouncyCastle Provider with only PKCS12 support"); - put("KeyStore.PKCS12", BCPKCS12KeyStore.class.getName()); - } -}