SSLSocket and client public key issue
Hi All
I am writing a server that will use SSLSocket. I am new to this. I have created the server private key, public key, dummy client private key, public key. Now the problem is that to create a SSLSocket i am using the client public key which i created, but the problem is that in mycase all clients will have their own public - private key. So basically i have no clue as to how to integrate all those public keys in my program.
If anyone can give any pointers in this issue.
Thanks and Regards
Pankaj Tiwari
Here is a part of code that uses the keystore
Variables
private String SKEYSTORE="D:\\eclipsetest\\FDRTest\\certificates\\server\\client.public";
private String CKEYSTORE="D:\\eclipsetest\\FDRTest\\certificates\\client\\server.private";
privatechar[] KEYSTOREPW="123456".toCharArray();
these lines are from the init method that initialises the server socket
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
KeyStore serverkeystore = KeyStore.getInstance("JKS");
KeyStore clientkeystore=KeyStore.getInstance("JKS");
serverkeystore.load(new FileInputStream(SKEYSTORE), KEYSTOREPW);
clientkeystore.load(new FileInputStream(CKEYSTORE), KEYSTOREPW);
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
tmf.init(serverkeystore);
KeyManagerFactory kmf=KeyManagerFactory.getInstance("SunX509");
kmf.init(clientkeystore,"123456".toCharArray());
SSLContext sslc = SSLContext.getInstance("TLS");
sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(),null);
ServerSocketFactory ssf = sslc.getServerSocketFactory();
SSLServerSocket serverSocket =(SSLServerSocket)
ssf.createServerSocket(portnumber);
serverSocket.setNeedClientAuth(true);

