Skip to content

Instantly share code, notes, and snippets.

@beginor
Forked from jebai0521/gist:9975293
Created April 9, 2014 08:28
Show Gist options
  • Select an option

  • Save beginor/10241387 to your computer and use it in GitHub Desktop.

Select an option

Save beginor/10241387 to your computer and use it in GitHub Desktop.

Revisions

  1. Chen Ming created this gist Apr 4, 2014.
    15 changes: 15 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    1. 生成keystore
    注册在填写名子与姓氏时需要填写tomcat的主机ip地址
    keytool -genkey -v -alias tomcat -keyalg RSA -keystore tomcat.keystore -validity 365
    2. 准备生成 CA 的key
    openssl genrsa -out myCA.key 2048
    3. 生成 CA
    openssl req -x509 -new -key myCA.key -out myCA.cer -days 730 -subj /CN="Sencloudx Custom CA"
    4. 准备从 CA 请求认证的请求文件
    keytool -certreq -alias tomcat -keystore tomcat.keystore -file server.csr
    5. 从CA请求认证
    openssl x509 -req -in server.csr -out server.cer -CAkey myCA.key -CA myCA.cer -days 365 -CAcreateserial -CAserial serial
    6. 导入 CA 根证书
    keytool -import -trustcacerts -keystore tomcat.keystore -alias root -file myCA.cer
    7. 导入认证证书
    keytool -import -keystore tomcat.keystore -alias tomcat -file server.cer