Disable SSL-encryption on a SSLSocket

E

Elian Kool

Hello

I have to receive unencrypted data on a SSLSocket shortly after I
started the connection (SSL handling works).

It works the following way (little shortened...):

Socket sock = new Socket(Server,Port);
SSLSocket sslsock = SSLSocketFactory.createSocket(sock,Server,Port,
false);
sslsock.Send("bla");
sslsock.close();
sock.Send("bla2");

The only problem is that sslsock.close() sends some data (23 bytes) to
the server (I assume to terminate the SSL session).

Is there a way to
a) Stop SSLSocket from sending these bytes
b) Read raw data from the SSLSocket (before decryption...)

I know it sounds strange, but unfortunately I don't have another
choice (after the login procedure, encryption is done with a
proprietary mechanism).

elian
 
E

Esmond Pitt

Elian said:
Hello

I have to receive unencrypted data on a SSLSocket shortly after I
started the connection (SSL handling works).

It works the following way (little shortened...):

Socket sock = new Socket(Server,Port);
SSLSocket sslsock = SSLSocketFactory.createSocket(sock,Server,Port,
false);
sslsock.Send("bla");
sslsock.close();
sock.Send("bla2");

The only problem is that sslsock.close() sends some data (23 bytes) to
the server (I assume to terminate the SSL session).

Is there a way to
a) Stop SSLSocket from sending these bytes
b) Read raw data from the SSLSocket (before decryption...)

I know it sounds strange, but unfortunately I don't have another
choice (after the login procedure, encryption is done with a
proprietary mechanism).

You don't need that, you just need to read the SSLSocket at the server
until you get EOF, then read the raw socket at the server and you should
get 'bla2', if you've set it up the same way as above (i.e. SSLSocket
wrapping an existing socket with autoClose=off). (If you haven't, there
is no point in what you're trying to do, just keep using SSL.)
 
E

Elian Kool

Esmond Pitt said:
You don't need that, you just need to read the SSLSocket at the server
until you get EOF, then read the raw socket at the server and you should
get 'bla2',

Well, the problem is
a) The server has different SSL implementation (ILE C on IBM iSeries)
and handles this a little different
b) Is has to be compatible with the existing Windows client which uses
OpenSSL.dll (and doen't send a close_notify...)

Any idea how to "fix" this on the client side?
if you've set it up the same way as above (i.e. SSLSocket
wrapping an existing socket with autoClose=off). (If you haven't, there
is no point in what you're trying to do, just keep using SSL.)

Sure I did, otherwise it wouldn't work at all :)

elian
 
E

Esmond Pitt

The question seems to be whether or not to close the client SSLSocket.
This depends on what the mainframe does, which you haven't described.
Have you tried just flushing the SSLSocket instead of closing it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top