{"id":5526,"date":"2019-11-27T18:52:49","date_gmt":"2019-11-27T10:52:49","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=5526"},"modified":"2019-11-28T21:48:23","modified_gmt":"2019-11-28T13:48:23","slug":"openssl","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/openssl","title":{"rendered":"openssl\u547d\u4ee4 – \u52a0\u5bc6\u7b97\u6cd5"},"content":{"rendered":"\n
openSSL\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5b89\u5168\u5957\u63a5\u5b57\u5c42\u5bc6\u7801\u5e93\uff0c\u56ca\u62ec\u4e3b\u8981\u7684\u5bc6\u7801\u7b97\u6cd5\u3001\u5e38\u7528\u7684\u5bc6\u94a5\u548c\u8bc1\u4e66\u5c01\u88c5\u7ba1\u7406\u529f\u80fd\u53caSSL\u534f\u8bae\uff0c\u5e76\u63d0\u4f9b\u4e30\u5bcc\u7684\u5e94\u7528\u7a0b\u5e8f\u4f9b\u6d4b\u8bd5\u6216\u5176\u5b83\u76ee\u7684\u4f7f\u7528\u3002\u5bf9\u5e94\u7684\u547d\u4ee4\u5c31\u662fopenssl\u547d\u4ee4\uff0c\u7528\u4e8e\u52a0\u5bc6\u7b97\u6cd5\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>openssl [\u53c2\u6570] <\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong> <\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong> <\/p>\n\n\n\n \u7528SHA1\u7b97\u6cd5\u8ba1\u7b97\u6587\u4ef6file.txt\u7684\u54c8\u897f\u503c\uff0c\u8f93\u51fa\u5230stdout\uff1a<\/p>\n\n\n\n \u7528SHA1\u7b97\u6cd5\u8ba1\u7b97\u6587\u4ef6file.txt\u7684\u54c8\u897f\u503c\uff0c\u8f93\u51fa\u5230\u6587\u4ef6digest.txt\uff1a<\/p>\n\n\n\n \u5bf9\u79f0\u52a0\u5bc6\u5e94\u7528\u4f8b\u5b50\uff0c\u7528DES3\u7b97\u6cd5\u7684CBC\u6a21\u5f0f\u52a0\u5bc6\u6587\u4ef6plaintext.doc\uff0c\u52a0\u5bc6\u7ed3\u679c\u8f93\u51fa\u5230\u6587\u4ef6ciphertext.bin:<\/p>\n\n\n\n DES3\u7b97\u6cd5\u7684OFB\u6a21\u5f0f\u89e3\u5bc6\u6587\u4ef6ciphertext.bin\uff0c\u63d0\u4f9b\u7684\u53e3\u4ee4\u4e3atrousers\uff0c\u8f93\u51fa\u5230\u6587\u4ef6plaintext.doc:<\/p>\n\n\n\n \u751f\u62101024\u4f4dDSA\u53c2\u6570\u96c6\uff0c\u5e76\u8f93\u51fa\u5230\u6587\u4ef6dsaparam.pem:<\/p>\n\n\n\n \u4f7f\u7528\u53c2\u6570\u6587\u4ef6dsaparam.pem\u751f\u6210DSA\u79c1\u94a5\u5319\uff0c\u91c7\u75283DES\u52a0\u5bc6\u540e\u8f93\u51fa\u5230\u6587\u4ef6dsaprivatekey.pem:<\/p>\n\n\n\n \u4ea7\u751f1024\u4f4dRSA\u79c1\u5319\uff0c\u75283DES\u52a0\u5bc6\u5b83\uff0c\u53e3\u4ee4\u4e3atrousers\uff0c\u8f93\u51fa\u5230\u6587\u4ef6rsaprivatekey.pem:<\/p>\n\n\n\n openSSL\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5b89\u5168\u5957\u63a5\u5b57\u5c42\u5bc6\u7801\u5e93\uff0c\u56ca\u62ec\u4e3b\u8981\u7684\u5bc6\u7801\u7b97\u6cd5\u3001\u5e38\u7528\u7684\u5bc6\u94a5\u548c\u8bc1\u4e66\u5c01\u88c5\u7ba1\u7406\u529f\u80fd\u53caSSL\u534f\u8bae\uff0c\u5e76 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5526"}],"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=5526"}],"version-history":[{"count":9,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5526\/revisions"}],"predecessor-version":[{"id":5832,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/5526\/revisions\/5832"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=5526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=5526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=5526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-in<\/td> \u8f93\u5165<\/td><\/tr> -out<\/td> \u8f93\u51fa<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n [root@linuxcool ~]# openssl dgst -sha1 file.txt<\/pre>\n\n\n\n
[root@linuxcool ~]# openssl sha1 -out digest.txt file.txt<\/pre>\n\n\n\n
[root@linuxcool ~]# openssl enc -des3 -salt -in plaintext.doc -out ciphertext.bin<\/pre>\n\n\n\n
[root@linuxcool ~]# openssl enc -des-ede3-ofb -d -in ciphertext.bin -out plaintext.doc -pass pass:trousers<\/pre>\n\n\n\n
[root@linuxcool ~]# openssl dsaparam -out dsaparam.pem 1024<\/pre>\n\n\n\n
[root@linuxcool ~]# openssl gendsa -out dsaprivatekey.pem -des3 dsaparam.pem<\/pre>\n\n\n\n
[root@linuxcool ~]# openssl genrsa -out rsaprivatekey.pem -passout pass:trousers -des3 1024<\/pre>\n","protected":false},"excerpt":{"rendered":"