-
-
Notifications
You must be signed in to change notification settings - Fork 184
Description
Hi, is there a way for send the certificate when opening a page? The webpage that I try to open requests a certificate right at the opening (https://forexe.mfinante.gov.ro). I can get it done with HttpURLConnection but I need to enable javascript that's why I'm trying with htmlunit.
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(new X509ExtendedKeyManager[] {km}, null, null);
URL url = new URL("https://webserviceapl.anaf.ro/prod/FCTEL/rest/stareMesaj?id_incarcare=" + msg.id_incarcare);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if (connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection)
.setSSLSocketFactory(sc.getSocketFactory());
}
connection.setConnectTimeout(100000);
connection.setReadTimeout(100000);
connection.setInstanceFollowRedirects(true);
connection.setDoOutput(true);
I need to include that SSLContext in HtmlUnit somehow if it is even possible...