server:
1.生成:
keytool -genkey -validity 365 -keysize 1024 -alias server -keyalg RSA -keystore e://cert_new//server.jks -dname "CN=eilpm, OU=eilpm, O=eilpm, L=beijing, ST=beijing, C=CN" -storepass 111111 -keypass 111111
4.自签证书:(或者采取代码签发)
keytool -gencert -alias server -infile e://cert_new//M13521166690_20151208100030424.crt -outfile e://cert_new//M13521166690_20151208100030424.cer -keystore e://cert_new//server.jks -storepass 111111 -keypass 111111
client:
2.生成:
keytool -genkey -validity 365 -keysize 1024 -alias cgp -keyalg RSA -keystore e://cert_new//M13521166690_20151208100030424.jks -dname "CN=阿里, OU=百度, O=新浪, L=beijing, ST=beijing, C=CN" -storepass 222222 -keypass 222222
3.生成申请:
keytool -certreq -keystore e://cert_new//M13521166690_20151208100030424.jks -alias cgp -file e://cert_new//M13521166690_20151208100030424.crt -storepass 222222
5.导入签名证书:
keytool -importcert -alias cgp -file e://cert_new//M13521166690_20151208100030424.cer -storepass 222222
以上需要jdk1.8,否则不支持keytool -gencert
代码签发:
package com;
import java.io.FileInputStream;
import java.io.FileOutputStream;