What's the simplest way to write an HTTPS client in Java?

Discussion in 'Java' started by Simon, Nov 28, 2007.

  1. Simon

    Simon Guest

    Hello -

    I'm trying to write a simple Java client program that tries to establish a
    connection with a webserver over HTTPS. The webserver requires 2-way
    authentication, ie. the server authenticates itself to the server and
    vice-versa. I have a client certificate in the form of a P7B file. The
    server certificate is self-signed. I want to keep the client program as
    simple as possible, as it will be used to debug contentious communications
    issues.

    Is it possible to do this simply using the HttpsURLConnection class? It
    seems to have no way to import a certificate on the fly. It seems to require
    the use of other classes such as KeyStore, which adds complexity and reduces
    clarity.

    Can anyone offer advice?
    Simon, Nov 28, 2007
    #1
    1. Advertising

  2. On Nov 28, 11:25 am, "Simon" <> wrote:
    > Hello -
    >
    > I'm trying to write a simple Java client program that tries to establish a
    > connection with a webserver over HTTPS. The webserver requires 2-way
    > authentication, ie. the server authenticates itself to the server and
    > vice-versa. I have a client certificate in the form of a P7B file. The
    > server certificate is self-signed. I want to keep the client program as
    > simple as possible, as it will be used to debug contentious communications
    > issues.
    >
    > Is it possible to do this simply using the HttpsURLConnection class? It
    > seems to have no way to import a certificate on the fly. It seems to require
    > the use of other classes such as KeyStore, which adds complexity and reduces
    > clarity.
    >
    > Can anyone offer advice?


    I have not used 2-way auth over HTTPS, but for 1-way I found Apache's
    HTTPClient (http://jakarta.apache.org/httpcomponents/httpclient-3.x/
    sslguide.html) to work very well. It might be worth a look..as it
    could very well support 2-way auth.

    -cheers,
    Manish
    Manish Pandit, Nov 28, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brent Burkart
    Replies:
    5
    Views:
    764
    Jerry III
    Oct 16, 2003
  2. Alan Silver
    Replies:
    9
    Views:
    2,270
    Alan Silver
    Jun 26, 2005
  3. Replies:
    7
    Views:
    426
    Simon Brooke
    Nov 25, 2006
  4. Kenneth McDonald
    Replies:
    2
    Views:
    648
    John J. Lee
    Dec 29, 2006
  5. Knut Olsen-Solberg

    How to write the simplest Windows program?

    Knut Olsen-Solberg, Feb 19, 2007, in forum: C++
    Replies:
    6
    Views:
    350
    Ryszard
    Feb 20, 2007
Loading...

Share This Page