如何用jdk的keytool製作ssl證書

2021-08-31 14:13:02 字數 1027 閱讀 2257

c=cn,ou=it,o=yixiuwang,st=beijing,c=cn,l=hd,cn=192.168.1.122,[email protected]

伺服器證書

keytool -genkeypair -v -alias tomcat -keyalg rsa -validity 730 -keystore c:\ca\tomcat.keystore -dname "c=xx,ou=xx,o=xx,st=beijing,c=cn,l=hd,cn=192.168.1.122,[email protected]" -storepass 1234 -keypass 1234

客戶端證書

keytool -genkeypair -v -alias client -keyalg rsa -storetype pkcs12 -validity 730 -keystore c:\ca\client.p12 -dname "cn=client,ou=it,o=***,l=any,st=bj,c=cn" -storepass 1234 -keypass 1234

讓伺服器信任客戶端證書

keytool -exportcert -alias client -keystore c:\ca\client.p12 -storetype pkcs12 -storepass 1234 -rfc -file c:\ca\cacert.cer

將該檔案匯入伺服器的證書庫,新增為乙個信任證書

keytool -importcert -v -file c:\ca\cacert.cer -keystore c:\ca\tomcat.keystore -storepass 1234

檢視伺服器證書庫,看到伺服器證書和

keytool -list -v -keystore c:\ca\tomcat.keystore -storepass 1234

將c:\ca\tomcat.keystore拷貝到c:\tomcat6.0

單雙向修改clientauth就可以了,可製作bat shell指令碼 注意linux下「\」和windows下「/」的區別

JDK自帶的keytool證書工具用法

keytool genkey alias tomcat keyalg rsa keystore d tomcat.keystore keypass 123456 storepass 123456 dname cn xingming,ou danwei,o zuzhi,l shi,st sheng,c...

利用JDK的keytool工具生成證書的DOS命令

b 1 生成伺服器端證書 b e jdk1.6 bin color blue keytool genkey v alias tomcat keyalg rsa keystore d ssl serv er tomcat.keystore dname cn 127.0.0.1,ou pde,o pde...

使用JDK自帶的keytool工具生成證書

使用jdk自帶的keytool工具生成證書 1 使用jdk自帶的keytool工具生成證書 匯出證書 keytool export filed keys wsria.crt alias wsria keystore d keys wsriakey 為客戶端的jvm匯入證書 d jdk1.7 jre ...