• 根据JSSE的JKS密钥库得到nginx所需的openssl格式私钥及证书


    首先,源密钥库是JSSE规范的JKS格式,存在的也只是自签名证书;

    其次,获取目标为openssl格式的私钥以及自签名证书,供nginx开放ssl测试用;

    1,生成JKS格式密钥库,含自签名证书:

    keytool -genkey -v -alias merrick -keyalg RSA -storetype JKS -keystore test1.jks -dname "CN=localhost,OU=merrick,O=COMPANY,L=CZ,ST=JS,C=CN" -storepass 123456 -keypass 123456 -validity 3650

    2,把JKS格式的密钥库转为PKCS12格式的密钥库:

    keytool -importkeystore -srckeystore test1.jks -destkeystore test1.p12 -srcstoretype JKS -deststoretype PKCS12 -srcstorepass 123456 -deststorepass 123456 -srcalias merrick -destalias merrick -srckeypass 123456 -destkeypass 123456 -noprompt
    查看:keytool -list -v -keystore test1.p12

    3,导出二进制der证书:

    keytool -export -alias merrick -keystore test1.p12 -storepass 123456 -file test1.cer

    查看:keytool -printcert -v -file test1.cer

    4,openssl生成文本格式私钥,无密码:

    openssl pkcs12 -in test1.p12 -nocerts -nodes -out test1.key -passin pass:123456

    5,openssl生成文本格式证书:

    openssl x509 -inform der -in test1.cer -out test1.crt

    6,nginx有关https配置:

    nginx.conf配置:
      ssl_certificate  test1.crt;
      ssl_certificate_key test1.key;

    7,实际商业部署的需要第三方的证书认证机构签发流程的情况,以上步骤不适用。

  • 相关阅读:
    静态方法和类方法
    DEL: Restore Boxes after VirtualBox Upgrade
    DEL: IE "Your current security settings put your computer at risk. Click h
    EV: Using GitHub Repository
    EV: Windows Commands 命令
    EV: Notepad++ Regular Express syntax
    html页面的三个width: document, window, screen
    DEL: View web content zone in IE9
    EV: 关于min-width样式的使用
    EV: Linux Shell Commands
  • 原文地址:https://www.cnblogs.com/m160331/p/12142339.html
Copyright © 2020-2023  润新知