For Programmers: Free Programming Magazines  


Home > Archive > Java Security > December 2004 > Unable to read from SSLSocket









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Unable to read from SSLSocket
Sonu

2004-12-28, 9:12 am

I am getting the following exception when I try to read after having
connected to a SSL enabled FTP server:

main, handling exception: javax.net.ssl.SSLException: Unrecognized SSL
message, plaintext connection?
main, SEND TLSv1 ALERT: fatal, description = unexpected_message
main, WRITE: TLSv1 Alert, length = 2
main, called closeSocket()
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
connection?


I have created a SSLSocket like this:
ctx = SSLContext.getInstance("TLS");
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
SSLSocketFactory m_sslSocketFactory = ctx.getSocketFactory();
SSLSocket sslSocket =(SSLSocket)m_sslSocketFactory.createSocket("stdevt09",
1990);

After creating Socket I am able to print out the enabled cipher suites
so I am assuming that the connection was eshtablished successfully but
while reading from socket stream there is a problem.

Thanks in Advance,
Swatantra
Ranga

2004-12-29, 4:00 pm

Swatantra,

Are you sure that the FTP server that you are connecting to is SSL
enabled and not SSH enabled? The commonly known "SFTP" is SSH enabled -
not SSL enabled. SSH and SSL are not the same; hence the java SSL APIs
will not work in such a situation.

-Ranga

Sonu wrote:
> I am getting the following exception when I try to read after having
> connected to a SSL enabled FTP server:
>
> main, handling exception: javax.net.ssl.SSLException: Unrecognized

SSL
> message, plaintext connection?
> main, SEND TLSv1 ALERT: fatal, description = unexpected_message
> main, WRITE: TLSv1 Alert, length = 2
> main, called closeSocket()
> javax.net.ssl.SSLException: Unrecognized SSL message, plaintext
> connection?
>
>
> I have created a SSLSocket like this:
> ctx = SSLContext.getInstance("TLS");
> ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
> SSLSocketFactory m_sslSocketFactory = ctx.getSocketFactory();
> SSLSocket sslSocket

=(SSLSocket)m_sslSocketFactory.createSocket("stdevt09",
> 1990);
>
> After creating Socket I am able to print out the enabled cipher

suites
> so I am assuming that the connection was eshtablished successfully

but
> while reading from socket stream there is a problem.
>
> Thanks in Advance,
> Swatantra


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com