Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how I overcome ssl 1

Status
Not open for further replies.

fuadhamidov

Programmer
Sep 22, 2003
98
TR
hi

i have problem with ssl.

i get data from bank.
bank web site ( https:// ) use certificate.
my code is bellow

URL urlBank = new URL(strUrl);
System.out.println("1");
URLConnection uc = urlBank.openConnection();
System.out.println("2");
HttpsURLConnection httpConnection = (HttpsURLConnection)uc;
System.out.println("3");
BufferedReader in = new BufferedReader(new InputStreamReader(httpConnection.getInputStream()));
System.out.println("4");


it prints 3, then catch exception.
I have installed .cer to my IE
 
what was the specific exception that was thrown? you also need to figure out which part is throwing the exception- is it when getting the input stream or constructing a reader?<br><br>try this:<br><br>InputStream is = httpConnection.getInputStream();<br>BufferedReader in = new BufferedReader(new InputStreamReader(is));<br><br>you need to see which of those two lines it's failing on, and what the thrown exception is. <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
OK i have tried and again prints until 3 :(

System.out.println(&quot;3&quot;);
InputStream is = httpConnection.getInputStream();
System.out.println(&quot;3,5&quot;);
BufferedReader in = new BufferedReader(new InputStreamReader(is));
System.out.println(&quot;4&quot;);

The exception i get is

java.io.IOException: HTTPS hostname wrong: should be <...,...,...,...>, but cert says <aaa>

...,...,...,... : IP that i connect

aaa : certificate name

Are the certificate name and bank url should be same. How certificate does work, I dont know.
 
Well your problem is quite apparent from the error message - the hostname is wrong. Change your hostname to the one it requires, and you'll be away ...
 
hi

i can access the web site from IE. i have installed certificate to my IE, named aaa. i can't understand. i am away to certificate. if i define my url like


Does it work? i have tried but i get an other exception

java.net.UnknownHostException: aaa
 
Have you mapped aaa to an actual IP in your hosts file ?
 
Well, on linux there is a hosts file in /etc, and in windows it is in C:\WINNT\system32\drivers\etc. In this file, you should have this line :

Code:
192.168.2.3    aaa    # my SSL server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top