Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8066269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:55:55+00:00 2026-06-05T11:55:55+00:00

I have a file with the ‘.pfx’ extension and a password to this certificate.

  • 0

I have a file with the ‘.pfx’ extension and a password to this certificate.

What I need to do is to send a simple GET request to a webservice and read the response body.

I need to implement a method similar to this:

String getHttpResponse(String url, String certificateFile, String passwordToCertificate){
    ...
}

I also tried converting the certificate to a format “with no password” using openssl:

Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM:
openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes

So the alternate implementaion of the my method could be:

String getHttpResponse(String url, String certificateFile){
    ...
}

I would really appreciate your help, I spent half a day googling for it, but I haven’t found an example that would help me, it seems I have problems with undestanding some basic assumptions around SSL and stuff.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:55:56+00:00Added an answer on June 5, 2026 at 11:55 am

    I finally found a good solution (without creating custom SSL context):

    String getHttpResponseWithSSL(String url) throws Exception {
        //default truststore parameters
        System.setProperty("javax.net.ssl.trustStore", "/usr/lib/jvm/java-6-openjdk/jre/lib/securitycacerts");
        System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
        System.setProperty("javax.net.ssl.trustStoreType", "JKS");
    
        //my certificate and password
        System.setProperty("javax.net.ssl.keyStore", "mycert.pfx");
        System.setProperty("javax.net.ssl.keyStorePassword", "mypass");
        System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
    
    
        HttpClient httpclient = new HttpClient();
    
        GetMethod method = new GetMethod();
        method.setPath(url);
    
        int statusCode = httpclient.executeMethod(method);
        System.out.println("Status: " + statusCode);
    
        method.releaseConnection();
    
        return method.getResponseBodyAsString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the web page, I have file upload widget. I need to show this
I have file with bitarray that looks like this: 10000000000000000000000000000000000000000000000000000000000000000000001000000 I need to make
I have file that I need to hash, this file can be too large
I have file in Assets and I need to write this file to the
I have file names that are in this format: anytext_NUMBER_svm.pkl I need to loop
i have file like this a,205 b,214 c,223 ,13 and i need to parse
Say I have file - a.csv ram,33,professional,doc shaym,23,salaried,eng Now I need this output (pls
Suppose that we have file like this: sometext11 sometext12 sometext13 sometext21 sometext22 sometext23 Texts
Suppose I have file which goes like this : a void measure() { a
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.