Skip to content

TLS 1.2 client certificate authentification #623

Description

@alexvrv

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...

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions