null cert chain

Hello,

I have created a keystore file and a certificate at FTP server side. when i connect through FlashFXP (ftp client) then there is an error at server and client .

Server side Error

javax.net.ssl.SSLHandshakeException: null cert chain

com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(Unknown Source)

com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)

com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)

com.sun.net.ssl.internal.ssl.SunJSSE_aw.a(Unknown Source)

com.sun.net.ssl.internal.ssl.SunJSSE_aw.a(Unknown Source)

com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(Unknown Source)

com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)

com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(Unknown Source)

com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)

com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)

sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(Unknown Source)

sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(Unknown Source)

sun.nio.cs.StreamEncoder$CharsetSE.implFlush(Unknown Source)

sun.nio.cs.StreamEncoder.flush(Unknown Source)

java.io.OutputStreamWriter.flush(Unknown Source)

com.ftpserver.FtpWriter.write(FtpWriter.java:192)

Mon Jul 17 13:55:08 IST 2006 :: at com.ftpserver.FtpWriter.send(FtpWriter.java:158)

com.ftpserver.RequestHandler.run(RequestHandler.java:223)

java.lang.Thread.run(Unknown Source)

javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: null cert chain

com.sun.net.ssl.internal.ssl.SSLSocketImpl.d(Unknown Source)

com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)

sun.nio.cs.StreamDecoder$CharsetSD.readBytes(Unknown Source)

sun.nio.cs.StreamDecoder$CharsetSD.implRead(Unknown Source)

sun.nio.cs.StreamDecoder.read(Unknown Source)

java.io.InputStreamReader.read(Unknown Source)

java.io.BufferedReader.fill(Unknown Source)

java.io.BufferedReader.readLine(Unknown Source)

java.io.BufferedReader.readLine(Unknown Source)

com.ftpserver.RequestHandler.run(RequestHandler.java:229)

java.lang.Thread.run(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: Caused by: javax.net.ssl.SSLHandshakeException: null cert chain

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.SunJSSE_aw.a(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.SunJSSE_aw.a(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at sun.nio.cs.StreamEncoder.flush(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at java.io.OutputStreamWriter.flush(Unknown Source)

Mon Jul 17 13:55:08 IST 2006 :: at com.ftpserver.FtpWriter.write(FtpWriter.java:192)

Mon Jul 17 13:55:08 IST 2006 :: at com.ftpserver.FtpWriter.send(FtpWriter.java:158)

Mon Jul 17 13:55:08 IST 2006 :: at com.ftpserver.RequestHandler.run(RequestHandler.java:223)

Client side Error

WinSock 2.0 -- OpenSSL 0.9.7g 11 Apr 2005

[R] Connecting to 192.168.5.41 -> IP=192.168.5.41 PORT=6578

[R] Connected to 192.168.5.41

[R] Connected. Negotiating SSL session..

[R] error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert bad certificate

[R] Failed SSL negotiation, disconnected

[R] Connection failed (Connection closed by client)

[R] Delaying for 120 seconds before reconnect attempt #1

I create key file by this command

Process pp=run.exec("C://j2sdk1.4.2_08/bin/keytool -v " +

"-genkey -alias ftpserver -keyalg RSA " +

"-dname \"CN=qbitsystems, OU=ftpserver, O=qbitsystems, L=jaipur, S=BC, C=US\" " +

"-validity 360 "+

"-keypass password " +

"-keystore D:/J2ee-Workspace/keys/.keystore " +

"-storepass password " );

THEN I GENERATE CERTIFICATE BY THIS COMMAND

Process pp=run.exec("C://j2sdk1.4.2_08/bin/keytool " +

"-certreq -v -alias ftpserver " +

"-keystore D:/J2ee-Workspace/cert/.keystore " +

"-file D:/J2ee-Workspace/cert/ftpcsr.crt " +

"-keypass password " +

"-storepass password"

);

Any help Please

Thanks in Advance

[5380 byte] By [raviadhaa] at [2007-10-3 3:15:30]
# 1

See the documentation for keytool.

keytool -genkey already produces a self-signed certificate, and keytool -certreq doesn't generate a certificate, it generates a Certificate Signing Request (CSR). Unless someone signs it and you import the result this will not do what you want.

You might need to do the whole CSR thing, it's impossible to say without knowing your security requirements.

ejpa at 2007-7-14 21:06:51 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2

Thank you ejp,

Let me explain my problem. i have developed a FTP server it is working fine on Explicit SSL, for implicit SSL, i want to create my self signed certificate by which i want to authenticate the any FTP client. can i do this ? or i have to choose some other way. i have create this self signed certificate at server side, and i tried to connect through FlashFXP client. Then it gives me this error.

Please help me. Am i wrong? if i am doing wrong then please advice me the right way . what should I do. I have been waiting for you help

sorry for my english.

Best Regards

raviadhaa at 2007-7-14 21:06:51 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 3

You can only use a self-signed certificate if the other end trusts it.

I'm not clear whether you just want your server to authenticate itself to clients as usual, or whether you also want clients to authenticate themselves to the server.

In the first case the server needs a certificate in its keystore which is trusted by the clients' truststores.

In the second case, each client will need a unique certificate that the server truststore trusts.

ejpa at 2007-7-14 21:06:51 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 4

client can be nay third party tool then how it will trust on my self signed certificare.

Yes, my server will authonticate to the any FTP client, when it connect.

okey, i''ll store certificate in keystore then how can i find the it will be trusted by the end client truststore. bcz can be any.

Best Regards

raviadhaa at 2007-7-14 21:06:51 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 5

> client can be nay third party tool then how it will

> trust on my self signed certificare.

It won't. Why should it? That's why you need it signed by a cert authority.

> okey, i''ll store certificate in keystore then how

> can i find the it will be trusted by the end client

> truststore. bcz can be any.

I do not understand this sentence.

ejpa at 2007-7-14 21:06:51 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...