aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes any Idea about the new new javax.net.ssl.HttpsURLConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "any Idea about the new new javax.net.ssl.HttpsURLConnection" Watch "any Idea about the new new javax.net.ssl.HttpsURLConnection" New topic
Author

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

Anirban Chatterjee
Greenhorn

Joined: Feb 06, 2001
Posts: 18
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
Alex Givant
Greenhorn

Joined: Nov 12, 2001
Posts: 23
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

Joined: Feb 06, 2001
Posts: 18
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
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
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

Joined: Feb 06, 2001
Posts: 18
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
Mark Burhans
Greenhorn

Joined: Jan 06, 2003
Posts: 1
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.


--<br />Mark
Zabe Agha
Greenhorn

Joined: Feb 27, 2003
Posts: 19
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: any Idea about the new new javax.net.ssl.HttpsURLConnection
 
Similar Threads
Having problem posting to Https.
lower or higher
Overriding the Security Certificate
Struts validation issue: Cannot load a validator resource
dispatchMethod in DispatchAction