开发者

Where to place SSL certificate for java application

Hello all I want to generate a certificate using keystore than add this to my sevrer and browse my sever using IE. I need the steps for generating the certificate in plain english as all what i read in the internet is hard to be understod. The server socket is:

SSLServerSocketFactory ssf = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();    
SSLServerSocket Server = (SSLServerSocket)ssf.createServerSocket(1234);      
String[] cipher = {"SSL_DH_anon_WITH_RC4_128_MD5"};      
Server.setEnabledCipherSuites(cipher); 

The certificate code is this but not sure where to pu it in my server:

InputStream infil = new FileInputStream("server.cer");开发者_运维技巧      
CertificateFactory cf = CertificateFactory.getInstance("X.509");      
X509Certificate cert = (X509Certificate)cf.generateCertificate(infil);      
infil.close();      
KeyStore ks = null;      
ks = KeyStore.getInstance("JKS", "SUN"); 
InputStream is = null; 
is = new FileInputStream(new File("./keystore")); 
ks.load(is,"rootroot".toCharArray()); 


See the Javadoc/Security/JSSE Reference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜