• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

any Idea about the new new javax.net.ssl.HttpsURLConnection

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
Has any one got idea about the new package javax.net.ssl.HttpsURLConnection
in the JESE 1.4 .
There are a couple of parameters which needs to be set before making a HTTPS request .
I am not able to figure that out ,any help would be appreciated.
A
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is not much to set, I would suggest that you can set your
own HostnameVerifier (it's like callback that check if name of
the host in server's certificate is the same as name of host
that you connect to).
After that you just getInputStream() and getOutputStream() and
you do whatever you do with regular input/output streams.
If you want to know which cipher suite is using for connection,
call to getCipherSuite().
To get server certificates call to getServerCertificates().
That's pretty it.
If you have any other question, ask, it's always pleasure to
help.
Have a nice day.
Alex Givant.
 
Anirban Chatterjee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Alex ,
I get the following exception :
javax.net.ssl.SSLHandshakeException: Couldn't find trusted certificate
This is the code I am making use of :
I have blotted out the company specific data by xx& yy
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't encountered this message, but I wonder whether the server's certificate has been signed by an authority not in your cacerts file. Or maybe the server is requesting a client certificate.
Can you do a little test? Try connecting to https://www.verisign.com. Does that work?
- Peter
 
Anirban Chatterjee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
It didnt work ,
I removed the part which concerns with making a POST request , and compiled the code for https://www.verisisign.com .
I got a run-time eception :
java.net.UknownHostException: www.verisign.com
Do you have any idea what's missing ..?
Thanks
Anirban
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am running into this as well. With my situation I'm POSTing to SSL Webservers that "we own". What I did was get the Certificate from the Webserver and import it into my applications truststore. Then I run the application that is POSTing to the servlet with
-Djavax.net.ssl.trustStore=ncep
where "ncep" is the name of the key(trust)store that I imported the webserver's certificate into.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just had the same prob. Mark's answer (the previous one) is correct.
In case anyone needs to know how to do this:
http://httpunit.sourceforge.net/doc/sslfaq.html
See the : "import my existing certificate into the trust file for" section.
 
reply
    Bookmark Topic Watch Topic
  • New Topic