• keytool常用操作


    keytool

    秘钥需要存储在秘钥库中,秘钥库可以理解为一个存储了一个或多个秘钥的文件。一个秘钥库可以存储多个密钥对,每个秘钥对你都需要给他们取一个名字。

    D:softwareJavajdk1.7.0_79in>keytool
    密钥和证书管理工具
     
    命令:
     
     -certreq 生成证书请求
     -changealias 更改条目的别名
     -delete 删除条目
     -exportcert 导出证书
     -genkeypair 生成密钥对
     -genseckey 生成密钥
     -gencert 根据证书请求生成证书
     -importcert 导入证书或证书链
     -importkeystore 从其他密钥库导入一个或所有条目
     -keypasswd 更改条目的密钥口令
     -list 列出密钥库中的条目
     -printcert 打印证书内容
     -printcertreq 打印证书请求的内容
     -printcrl 打印 CRL 文件的内容
     -storepasswd 更改密钥库的存储口令
     
    使用 "keytool -command_name -help" 获取 command_name 的用法

    常用操作

    • 生成秘钥库
    keytool -genkeypair -alias "localhost" -keyalg "RSA" -keystore "d:localhost.keystore"
     
    keytool -genkey -keystore "d:localhost.keystore" -alias "localhost" -keyalg "RSA" -validity 365 -dname "CN=localhost, OU=org, O=org.cj, L=上海, ST=上海, C=中国" -keypass "123456" -storepass "123456"
    • 秘钥库添加条目
    keytool -genkey -keystore "d:localhost.keystore" -alias "localhost2" -keyalg "RSA" -validity 365 -dname "CN=127.0.0.1, OU=org, O=org.cj, L=上海, ST=上海, C=中国" -keypass "123456" -storepass "123456"
    • 秘钥库删除条目
    keytool -delete -keystore "d:localhost.keystore" -alias "localhost2"
    • 查看秘钥库信息
    keytool -list -v -keystore "d:localhost.keystore" -storepass "123456"
    • 导出某个条目的证书
    keytool -alias "localhost" -exportcert -keystore "d:localhost.keystore" -file "d:localhost.cer" -storepass "123456"
    • 证书导入JRE库
    keytool -import -alias "localhost" -keystore "C:Javajdk1.8.0_40jrelibsecuritycacerts" -file "D:localhost.cer" -trustcacerts -storepass "123456"
    • JRE库中删除某个证书
    keytool -delete -alias "localhost" -keystore "C:Javajdk1.8.0_40jrelibsecuritycacerts" -storepass "123456"
    • PFX证书转JSK
    keytool -importkeystore -srckeystore a.pfx -destkeystore a.jks -srcstoretype PKCS12 -deststoretype JKS
    • 修改秘钥库条目密码
    keytool -keypasswd -alias test1 -keypass testtesttest1 -new testtest1 -storepass testtest -keystore test.keystore
     
  • 相关阅读:
    perf-stat
    perf原理
    ubuntu中Docker的安装与使用
    NVM相关手册及新特性理解
    #2018BIT软件工程基础#结对项目:四则运算题目生成
    #2018BIT软件工程基础#个人项目:数独
    第一篇博文:自我介绍&新学期展望
    越早明白这些道理,越能少走一些弯路
    把知识连接起来就是创意
    【翻译】24款界面精美的免费UI工具包
  • 原文地址:https://www.cnblogs.com/LuisYang/p/10027865.html
Copyright © 2020-2023  润新知