大家好 我想使用密钥库生成证书,而不是将其添加到我的sevrer并使用IE浏览我的服务器。我需要用简单的英语生成证书的步骤,因为我在互联网上阅读的所有内容都很难被忽视。服务器套接字是:
SSLServerSocketFactory ssf = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
SSLServerSocket Server = (SSLServerSocket)ssf.createServerSocket(1234);
String[] cipher = {"SSL_DH_anon_WITH_RC4_128_MD5"};
Server.setEnabledCipherSuites(cipher);
证书代码是这样但不确定在我的服务器中将它放在哪里:
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());
答案 0 :(得分:0)
请参阅Javadoc / Security / JSSE Reference。