Keytool 是密鑰和證書的管理工具, 用來管理密鑰,X.509 證書鏈, 可信證書的密鑰庫(數(shù)據庫)
相關資料
具體操作
1. 命令介紹
? keytool --help
Key and Certificate Management Tool
Commands:
-certreq Generates a certificate request #生成一個證書請求文件, 用于向CA申請證書
-changealias Changes an entry's alias #變更別名
-delete Deletes an entry #刪除
-exportcert Exports certificate #導出證書
-genkeypair Generates a key pair #創(chuàng)建密鑰對
-genseckey Generates a secret key #創(chuàng)建密鑰
-gencert Generates certificate from a certificate request #根據 CSR 文件創(chuàng)建一個證書
-importcert Imports a certificate or a certificate chain #導入證書或證書鏈
-importkeystore Imports one or all entries from another keystore #從另一個keystore導入數(shù)據
-keypasswd Changes the key password of an entry #變更密碼
-list Lists entries in a keystore #列表顯示keystore中的全部數(shù)據
-printcert Prints the content of a certificate #打印證書內容
-printcertreq Prints the content of a certificate request #打印證書請求文件的內容
-printcrl Prints the content of a CRL file #打印已廢棄證書列表的內容
-storepasswd Changes the store password of a keystore #變更存儲密碼
Use "keytool -command_name -help" for usage of command_name
storepass: keystore文件本身也可以通過密碼加密
keypass: 用于加密keystore文件中密鑰的密碼
entry: 指keystore文件中存儲的密鑰,X.509 證書鏈, 可信證書
2. 創(chuàng)建 keystore 文件
keytool -genkey -alias {{alias_name}}} -keyalg RSA -storepass {{store_password}}} -keystore {{file_name}}}.keystore -keypass {{key_password}}
Paste_Image.png
3. 顯示 keystore 文件的版本信息
keytool -list -v -keystore {{file_name}}.keystore -storepass {{store_passowrd}}
Paste_Image.png
4. 使用 RFC 樣式顯示 keystore 文件的輸出
keytool -list -rfc -keystore {{file_name}}.keystore -storepass {{store_passowrd}}
Paste_Image.png