{"id":8675,"date":"2020-09-22T17:29:16","date_gmt":"2020-09-22T09:29:16","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=8675"},"modified":"2022-05-13T15:31:58","modified_gmt":"2022-05-13T07:31:58","slug":"keytool","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/keytool","title":{"rendered":"keytool\u547d\u4ee4 – \u5bc6\u94a5\u548c\u8bc1\u4e66\u7ba1\u7406\u5de5\u5177"},"content":{"rendered":"\n

keytool\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u7ba1\u7406\u5bc6\u94a5\u548c\u8bc1\u4e66\u6587\u4ef6\u3002\u5bc6\u94a5\u5c31\u662f\u7528\u4e8e\u52a0\u89e3\u5bc6\u7528\u7684\u6587\u4ef6\u6216\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u4f7f\u7528keytool\u547d\u4ee4\u8fdb\u884c\u751f\u6210\u3001\u5bfc\u5165\u548c\u5220\u9664\u7b49\u64cd\u4f5c\uff0c\u4e0d\u540c\u7684\u7a0b\u5e8f\u9700\u8981\u7684\u5bc6\u94a5\u683c\u5f0f\u4e5f\u4e0d\u5c3d\u76f8\u540c\uff0c\u9700\u8981\u7559\u610f\u5177\u4f53\u7684\u683c\u5f0f\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>keytool \u53c2\u6570<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-certreq<\/td>\u751f\u6210\u8bc1\u4e66\u8bf7\u6c42<\/td><\/tr>
-changealias<\/td>\u66f4\u6539\u6761\u76ee\u7684\u522b\u540d<\/td><\/tr>
-delete<\/td>\u5220\u9664\u6761\u76ee<\/td><\/tr>
-exportcert<\/td>\u5bfc\u51fa\u8bc1\u4e66<\/td><\/tr>
-genkeypait<\/td>\u751f\u6210\u5bc6\u94a5\u5bf9<\/td><\/tr>
-genseckey<\/td>\u751f\u6210\u5bc6\u94a5<\/td><\/tr>
-gencert<\/td>\u6839\u636e\u8bc1\u4e66\u8bf7\u6c42\u751f\u6210\u8bc1\u4e66<\/td><\/tr>
-importcert<\/td>\u5bfc\u5165\u8bc1\u4e66\u6216\u8bc1\u4e66\u94fe<\/td><\/tr>
-importkeystore<\/td>\u4ece\u5176\u4ed6\u5bc6\u94a5\u5e93\u5bfc\u5165\u4e00\u4e2a\u6216\u6240\u6709\u6761\u76ee<\/td><\/tr>
-keystore<\/td>\u8bc1\u4e66\u4fdd\u5b58\u4f4d\u7f6e<\/td><\/tr>
-keyalg <\/td>\u6307\u5b9a\u52a0\u5bc6\u7b97\u6cd5<\/td><\/tr>
-keypasswd<\/td>\u66f4\u6539\u6761\u76ee\u7684\u5bc6\u94a5\u53e3\u4ee4<\/td><\/tr>
-list<\/td>\u5217\u51fa\u5bc6\u94a5\u5e93\u4e2d\u7684\u6761\u76ee<\/td><\/tr>
-printcert<\/td>\u6253\u5370\u8bc1\u4e66\u5185\u5bb9<\/td><\/tr>
-printcertreq<\/td>\u6253\u5370\u8bc1\u4e66\u8bf7\u6c42\u7684\u5185\u5bb9<\/td><\/tr>
-printcrl<\/td>\u6253\u5370CRL\u6587\u4ef6\u7684\u5185\u5bb9<\/td><\/tr>
-storepasswd<\/td>\u66f4\u6539\u5bc6\u94a5\u5e93\u7684\u5b58\u50a8\u53e3\u4ee4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u751f\u6210\u4e00\u4e2a\u6307\u5b9a\u540d\u79f0\u7684\u8bc1\u4e66\u6587\u4ef6\uff0c\u52a0\u5bc6\u7c7b\u578b\u4e3aRSA\uff0c\u6709\u6548\u671f365\u5929\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# keytool -genkey -alias tomcat -keyalg RSA -keystore \/etc\/tomcat.keystore -validity 365<\/strong><\/pre>\n\n\n\n

\u5bfc\u5165\u4e00\u4e2a\u6307\u5b9a\u540d\u79f0\u7684\u8bc1\u4e66\u6587\u4ef6\uff0c\u5b9a\u4e49\u522b\u540d\u540d\u79f0\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# keytool -import -keystore cacerts -storepass 666666 -keypass 888888 -alias linuxcool -file \/etc\/tomcat.keystore<\/strong><\/pre>\n\n\n\n

\u5220\u9664\u4e00\u4e2a\u6307\u5b9a\u540d\u79f0\u7684\u8bc1\u4e66\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# keytool -delete -alias linuxcool -keystore cacerts -storepass 666666<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"

keytool\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u7ba1\u7406\u5bc6\u94a5\u548c\u8bc1\u4e66\u6587\u4ef6\u3002\u5bc6\u94a5\u5c31\u662f\u7528\u4e8e\u52a0\u89e3\u5bc6\u7528\u7684\u6587\u4ef6\u6216\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u4f7f\u7528keytool\u547d […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8675"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=8675"}],"version-history":[{"count":4,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8675\/revisions"}],"predecessor-version":[{"id":9668,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8675\/revisions\/9668"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=8675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=8675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=8675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}