view keystore data

Hello,would you plz tell me how can i view the keystore file datas. can i view these data using java API.Thanks In Advance
[143 byte] By [raviadhaa] at [2007-10-3 3:09:43]
# 1

Keystore ks = KeyStore.getInstance("JKS");

ks.load(new FileInputStream("path/to/your/keystore/file"), "<yourkeystrepassword>".toCharArray());

ks is then the loaded keystore. read

http://java.sun.com/j2se/1.4.2/docs/api/java/security/KeyStore.html

to see how you can acces the data inside. I sugget using:

aliases()

getCertificate(String alias)

etc.

Don't forget to import the needed packages...

import javax.net.ssl.*;

import java.security.*;

import java.security.cert.*;

import java.io.*;

import java.net.*;

etc

ctopfela at 2007-7-14 21:00:27 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2

thank you ctopfel, i got the solution. would you plz tell me , when i connect to ftp server using client then it gives me an error

javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake 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)

Sun Jul 16 15:43:55 IST 2006 :: at com.ftpserver.FtpWriter.send(FtpWriter.java:158)

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

java.lang.Thread.run(Unknown Source)

Caused by: java.io.EOFException: SSL peer shut down incorrectly

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

Sun Jul 16 15:43:55 IST 2006 :: ... 13 more

Sun Jul 16 15:43:55 IST 2006 :: Con 2006-07-16 15:46:04,468 -- WARN -- RequestHandler.run()

Sun Jul 16 15:43:55 IST 2006 :: java.lang.NullPointerException

Sun Jul 16 15:43:55 IST 2006 :: at com.ftpserver.RequestHandler.run(RequestHandler.java:226)

Sun Jul 16 15:43:55 IST 2006 :: at java.lang.Thread.run(Unknown Source)

Please help me how can i resolve this problem

Thanks

raviadhaa at 2007-7-14 21:00:27 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...