I'm a begginer for https requests and want to make an https request to https://client.badssl.com/
I am using the apache httpclient for my request
I downloaded the p12 file from badssl.com and the root certificate + intermediate certificate from chrome
I created a trustStore containing the two certificates
I downloaded from chrome as well as a keystore which contains the private key of the P12 file and the two .cer certificates
I also added the certificate to my java cacerts
and I added this configuration for my jvm configuration for a custum trustStore
-Djavax.net.ssl.keyStore=C:\jks\keystore.jks
-Djavax.net.ssl.keyStorePassword=badssl.com
-Djavax.net.ssl.keyStoreType=jks
-Djavax.net.ssl.trustStore=C:\jks\truststore.jks
-Djavax.net.ssl.trustStorePassword=badssl.com
-Djavax.net.ssl.trustStoreType=jks
but i don't know why i always get bad request 400 please help me
public class Test {
public static void main(String[] args) throws IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpget = new HttpGet("https://client.badssl.com/");
httpclient.execute(httpget);
}
}
my keystore
C:\jks>keytool -list -keystore keystore
Entrez le mot de passe du fichier de clés :
Type de fichier de clés : PKCS12
Fournisseur de fichier de clés : SUN
Votre fichier de clés d'accès contient 4 entrées
1, 22 mai 2022, PrivateKeyEntry,
Empreinte du certificat (SHA1) : 68:B5:22:00:77:DE:8B:BE:AE:D8:E1:C2:54:0F:EC:6C:16:B4:18:A8
*.badssl.com (r3), 22 mai 2022, trustedCertEntry,
Empreinte du certificat (SHA1) : 55:A2:BA:EF:39:AE:FF:19:81:A7:F3:47:C4:0C:E1:E2:8F:86:7F:F0
isrg root x1, 22 mai 2022, trustedCertEntry,
Empreinte du certificat (SHA1) : CA:BD:2A:79:A1:07:6A:31:F2:1D:25:36:35:CB:03:9D:43:29:A5:E8
r3 (isrg root x1), 22 mai 2022, trustedCertEntry,
Empreinte du certificat (SHA1) : A0:53:37:5B:FE:84:E8:B7:48:78:2C:7C:EE:15:82:7A:6A:F5:A4:05
my trustStore
C:\jks>keytool -list -keystore truststore
Entrez le mot de passe du fichier de clés :
Type de fichier de clés : PKCS12
Fournisseur de fichier de clés : SUN
Votre fichier de clés d'accès contient 3 entrées
*.badssl.com (r3), 22 mai 2022, trustedCertEntry,
Empreinte du certificat (SHA1) : 55:A2:BA:EF:39:AE:FF:19:81:A7:F3:47:C4:0C:E1:E2:8F:86:7F:F0
isrg root x1, 22 mai 2022, trustedCertEntry,
Empreinte du certificat (SHA1) : CA:BD:2A:79:A1:07:6A:31:F2:1D:25:36:35:CB:03:9D:43:29:A5:E8
r3 (isrg root x1), 22 mai 2022, trustedCertEntry,
Empreinte du certificat (SHA1) : A0:53:37:5B:FE:84:E8:B7:48:78:2C:7C:EE:15:82:7A:6A:F5:A4:05