Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: SSL client program Date: Sat, 14 May 2011 17:34:35 +0200 Organization: A noiseless patient Spider Lines: 93 Message-ID: References: <3af63731-b09e-44ff-bf37-1ffebdf80f60@o7g2000vbn.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Date: Sat, 14 May 2011 15:34:37 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="4tmwzJBImrnDXpMfMJhjUw"; logging-data="2782"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/oUgr3SUolsSMRmPk8FW9m" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:y8rNmbMZSR24HGWwWsTRP/igiLo= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4075 On 14/05/2011 10:54, Stone allegedly wrote: > On 13 kv=C4=9B, 18:57, Daniele Futtorovic net.invalid> wrote: >> On 13/05/2011 18:39, Daniele Futtorovic allegedly wrote: >> >>> On 13/05/2011 10:09, Stone allegedly wrote: >>>> Dear developers, >> >>>> I am trying to write some client program which will open port 5000 o= n >>>> the client side and connect to the computer where is run daemon whic= h >>>> listen on the port 5000. >>>> Those port should be secured over SSL. >>>> I have build up the C++ daemon which listen on that port together wi= th >>>> SSL and when I am writing >>>> command: >>>> openssl s_client -ssl3 -connect 192.168.0.120:9000 >>>> then in the log of daemon I can see that connection was establish an= d >>>> working correctly. >>>> Including server certificate, SSL handshake and Secure Renegotiation= >> >>>> I would like to created some client in Java but there I have some >>>> problems. >>>> When I run Java client application the in the daemon I see message: >> >>>> 24741:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version >>>> number:s3_pkt.c:295: >> >>>> My Java code is: >> >>> >> >>>> Those program is run from NetBeans directly >> >>> "Wrong version number". Check which version your OpenSSL client is, >>> check which version of Java you're using. Try updating both of them, = to >>> see if it fixes it. If that doesn't help, are you tied to SSL 3.0? Ja= va >>> supports TLS out-of-the-box. >> >>> Google for "SSL3_GET_RECORD:wrong version number:" did yield a lot of= >>> results. >> >>> HTH. >> >> Also, check whether you're using the Sun Provider. Find out the which >> class the SSLContext instance you're getting is. > > > This I do not understand. I am using java JRE from Sun Java (or > Oracle) pages. > Also JDK is installed on the my computer. > How can I find what SSLContext instace is using? > > One thing which I have observed during my tests is: > When my Java class is trying to connect openssl s_server all is > working fine. > When openssl s_client is trying to connect my C++ daemon that all is > working fine as well. > But when my Java class is trying to connect my C++ daemon that it > failed with the error described above. I misunderstood you. I thought you were calling OpenSSL from your C++=20 daemon, that OpenSSL was actually your daemon. So the problem appears to = be between what your Java program sends and what your C++ daemon=20 expects, not between what your Java program sends and OpenSSL, as I had=20 surmised. One way to check what provider your JRE is using is simply to do: SSLContext.getInstance("SSLv3").getClass().getName() and to print out the result. I don't know how you can check what whichever C++ library ("s3_pkt.c")=20 you're using expects, but I think the problem is between those two. As I mentioned, you might get out of your troubles simply by updating=20 the libraries you're using (JRE and C++) to the latest versions. You can = also search the web for the error you're getting. Sorry, but that's all=20 I can currently think of. --=20 DF. An escaped convict once said to me: "Alcatraz is the place to be"