Answer the question
In order to leave comments, you need to log in
How to send http request with SSL certificates?
There is a PHP script like this
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
curl_setopt($ch, CURLOPT_HEADER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_SSLCERT,PUBLIC_ENCODE_KEY__);
curl_setopt($ch, CURLOPT_SSLKEY,PRIVATE_KEY__);
curl_setopt($ch, CURLOPT_SSLKEYPASSWD,PASSWORD__);
$dt = curl_exec($ch);
HttpClient client = HttpClientBuilder.create().build();
HttpPost request = new HttpPost("...");
request.addHeader(new BasicHeader("Content-Type", "application/pkcs7-mime"));
request.setEntity(new StringEntity(data, "UTF-8"));
HttpResponse response = client.execute(request);
log.info("Response status code: {}", response.getStatusLine().getStatusCode());
HttpEntity entity = response.getEntity();
if (entity != null) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent()));
StringBuilder result = new StringBuilder();
String line = "";
while ((line = bufferedReader.readLine()) != null) {
result.append(line);
}
return result.toString();
}
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question