On Wed, Jun 18, 2008 at 2:14 PM, AverageGuy <[EMAIL PROTECTED]> wrote:

>
>
>
> Julius Davies-2 wrote:
> >
> > 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
> >
>
> OK
> [EMAIL PROTECTED]:~/java/sslSocket$ echo $JAVA_HOME
> /opt/jdk1.5.0_15/
> [EMAIL PROTECTED]:~/java/sslSocket$ which java
> /opt/jdk1.5.0_15//bin//java
>
> It changed the error.  I suspect it has to do with my inability to set the
> cipher as I mentioned before.
>
> Exception in thread "main" javax.net.ssl.SSLHandshakeException: Received
> fatal alert: handshake_failure
>
> Thanks,
> Jim.


Let me add this.  This is the "guts" of the C++ program I'm trying to
duplicate.  I ripped out the non essential code such as error checking,
debug output and statistic gathering.

Any suggestions on how to implement this in Java would be helpful.

            SSL_library_init ();
            SSL_METHOD *method;
            method = SSLv3_client_method ();
            ptrCTX = SSL_CTX_new (method);

            if (!SSL_CTX_set_cipher_list (ptrCTX, "ADH")) {
            ptrSSL = SSL_new (ptrCTX);
            int xx = SSL_set_fd (ptrSSL, fdSocket);

            SSL_load_error_strings ();
            SSL_set_connect_state (ptrSSL);
            sbio = BIO_new_socket (fdSocket, BIO_NOCLOSE);
            SSL_set_bio (ptrSSL, sbio, sbio);

            retcode = SSL_connect (ptrSSL);
            retcode =
                SSL_write (ptrSSL, (const void *) message.c_str (),
                           message.length ());
                retcode = SSL_read (ptrSSL, response, 200);

      SSL_shutdown(ptrSSL);
      SSL_free(ptrSSL);
      SSL_CTX_free(ptrCTX);

Thanks,
Jim.

Reply via email to