Your code is fine.  Don't use /usr/bin/java (the gnu jvm)!  Install a
JVM from Sun or IBM or BEA or Blackdown, or Kaffe, at the very least,
and use that instead.

After installing a vendor's JVM, make sure you use the "java"
executable they provide.  For example:

/opt/java/ibm-java-ppc-60/bin/java


yours,

Julius


On Wed, Jun 18, 2008 at 6:07 AM, AverageGuy <[EMAIL PROTECTED]> wrote:
> I am attempting to connect to an ssl server that isn't a web site. I have
> C++ client code that works and would like to get a java client working. My
> initial attempt fails with a
>
> Exception in thread "main" gnu.javax.net.ssl.provider.AlertException:
> ILLEGAL_PARAMETER: remotely generated; FATAL
>
> message. That's not surprising since it is a simple program that does
> essentially:
>
>         SocketFactory sf = SSLSocketFactory.getDefault();
>         Socket s = sf.createSocket(args[0], Integer.parseInt(args[1]));
>         BufferedOutputStream bro = new
> BufferedOutputStream(s.getOutputStream());
>         bro.write(buf,0,msgLen);
>
> And fails on the write. So I decided to add a context, since that's what the
> C++ code did.
>
>    SSLContext sc = SSLContext.getInstance ( "SSLv3" ) ;
>    sc.init (null,null,null) ;
>    sc.createSSLEngine();
>    SocketFactory sf = sc.getSocketFactory();
>
> This gives the same result. In the C++ code I specify a cipher, like:
>
>             if (!SSL_CTX_set_cipher_list (ptrCTX, "ADH")) {
>             ptrSSL = SSL_new (ptrCTX);
>             int xx = SSL_set_fd (ptrSSL, fdSocket);
>
> But I can't find a way to set a cipher into the context. The only mention of
> ciphers in the API seem to be in the SSLEngine class and I can't find a way
> to link that class into what I'm doing, so I'm pretty well stuck at this
> point. So one question, is that "SSLv3" an acceptable protocol? The only
> examples I've found set that to "SSL" but in the C++ code I have:
>
>             SSL_METHOD *method;
>             method = SSLv3_client_method ();
>             ptrCTX = SSL_CTX_new (method);
>
> I have no idea if that's the equivalent or not, I'm searching in the dark. I
> have read the "SSL and TLS" book but it like most examples assumes an http
> client which this is not.
>
> Another question is how do I specify a cipher and/or do I have to?
>
> Thanks for any pointers.
>
> Jim.
> ________________________________
> View this message in context: I'm having trouble getting an ssl client
> programmed in java
> Sent from the OpenSSL - User mailing list archive at Nabble.com.
>



-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to