{"id":40,"date":"2025-07-14T01:42:12","date_gmt":"2025-07-13T17:42:12","guid":{"rendered":"http:\/\/www.oldjiang.top\/?p=40"},"modified":"2025-07-14T10:01:42","modified_gmt":"2025-07-14T02:01:42","slug":"rsa%e5%8a%a0%e5%af%86%e7%ae%97%e6%b3%95","status":"publish","type":"post","link":"http:\/\/www.oldjiang.top\/?p=40","title":{"rendered":"RSA\u52a0\u5bc6\u7b97\u6cd5"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>RSA\u52a0\u5bc6\u7b97\u6cd5\u662f\u4e00\u79cd\u516c\u94a5\u52a0\u5bc6\u7b97\u6cd5\uff0c\u7531Ron Rivest\u3001Adi Shamir\u548cLeonard Adleman\u57281977\u5e74\u53d1\u660e\u3002RSA\u7b97\u6cd5\u7684\u5b89\u5168\u6027\u57fa\u4e8e\u6570\u8bba\u4e2d\u7684\u4e24\u4e2a\u91cd\u8981\u95ee\u9898\uff1a\u8d28\u56e0\u6570\u5206\u89e3\u548c\u6c42\u79bb\u6563\u5bf9\u6570\u3002RSA\u7b97\u6cd5\u901a\u8fc7\u5c06\u4e00\u7ec4\u5927\u7d20\u6570\u4e0e\u5176\u4ed6\u53c2\u6570\u7ed3\u5408\u8d77\u6765\u751f\u6210\u516c\u94a5\u548c\u79c1\u94a5\uff0c\u7528\u516c\u94a5\u52a0\u5bc6\u6570\u636e\uff0c\u7528\u79c1\u94a5\u89e3\u5bc6\u6570\u636e\uff0c\u5b9e\u73b0\u4e86\u4fe1\u606f\u7684\u5b89\u5168\u4f20\u8f93\u3002<\/p>\n\n\n\n<p>\u5177\u4f53\u6765\u8bf4\uff0cRSA\u7b97\u6cd5\u7684\u52a0\u5bc6\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul>\n<li>\u9009\u62e9\u4e24\u4e2a\u5927\u7d20\u6570p\u548cq\uff0c\u8ba1\u7b97N=p*q\u3002<\/li>\n\n\n\n<li>\u7136\u540e\u5f15\u5165N\u7684\u6b27\u62c9\u51fd\u6570\uff0c\u5373\u03c6(N)\uff0c\u03c6(N)=(p-1)*(q-1)<\/li>\n\n\n\n<li>\u9009\u62e9\u4e00\u4e2a\u6574\u6570e\uff0c1&lt;e&lt;\u03c6(N)\uff0c\u4e14e\u4e0e\u03c6(N)\u4e92\u8d28\uff0c\u901a\u5e38\u5199\u6210gcd(e, \u03c6(N))=1\uff1b \u5373e\u548c\u03c6(N)\u7684\u6700\u5927\u516c\u7ea6\u6570\u4e3a1.<\/li>\n\n\n\n<li>\u8ba1\u7b97d\uff0c\u4f7f\u5f97e*d\u5bf9\u03c6(N)\u53d6\u4f59\u5f971\uff0c \u4e5f\u53ef\u4ee5\u5199\u6210e*d\u4e0e1\u5173\u4e8e\u03c6(N)\u540c\u4f59: e*d=1 mod \u03c6(N)\uff0c<\/li>\n\n\n\n<li>\u5c06N\u548ce\u4f5c\u4e3a\u516c\u94a5\uff0cN\u548cd\u4f5c\u4e3a\u79c1\u94a5\u3002<\/li>\n\n\n\n<li>\u52a0\u5bc6\u539f\u59cb\u6570\u636eM\u65f6\uff0c\u5f97\u5230\u52a0\u5bc6\u6570\u636e M<sup>e<\/sup>=M^e mod N\u3002<\/li>\n\n\n\n<li>\u6b64\u5904\u7701\u7565\u52a0\u89e3\u5bc6\u6c42\u89e3\u8bc1\u660e\u7684\u6b65\u9aa4\u3002<\/li>\n\n\n\n<li>\u89e3\u5bc6\u6570\u636e\u65f6\uff0c\u53ea\u9700\u8981\u901a\u8fc7\u8ba1\u7b97M=M<sup>e<\/sup>^d mod N \u5f97\u5230\u539f\u59cb\u6570\u636eM\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4e3e\u4e00\u4e2a\u5c0f\u4f8b\u5b50\uff1a<br>\u5047\u8bbe p=3,q=11,<br>\u5f97\u5230 \u03c6(n)=(p-1)(q-1) = 20<br>\u672c\u4f8b\u4e2d\u53d6\u79c1\u94a5 d=7; <br>\u7531d*e=1mod\u03c6(p*q), \u4ee3\u5165d=7\uff0c\u5f97\u52307*e=1 mod20\uff0c\u53737*e \u4e0e1 \u5173\u4e8e20\u4f59\u6570\u76f8\u540c ,\u800c1\u9664\u4ee520\u4f59\u6570\u4e3a1 , \u52197*e=20k+1 ,\u5176\u4e2dk\u4e3a\u6574\u6570\uff0ce\u8981\u5c0f\u4e8e20\uff08\u03c6(p*q)\uff09\u7684\u6574\u6570\uff0c\u7b80\u5355\u8ba1\u7b97\u548c\u5237\u9009\u540e\u5f97\u5230\u516c\u94a5 e=3\u3002<br>\u52a0\u5bc6\u6570\u5b575: \u5f97\u5230\u5bc6\u6587M<sup>e<\/sup>=M^e mod N = 5^3 mod 33 = 26<br>\u89e3\u5bc6\u5bc6\u6587\u5f97\u5230\u539f\u6587\uff1aM=M<sup>e<\/sup>^d mod N=26^7 mod 33 = 5<\/p>\n\n\n\n<p>\u5728RSA\u7b97\u6cd5\u4e2d\uff0c\u516c\u94a5\uff08N\uff0ce\uff09\u7528\u4e8e\u52a0\u5bc6\u6570\u636e\uff0c\u79c1\u94a5\uff08N\uff0cd\uff09\u7528\u4e8e\u89e3\u5bc6\u6570\u636e\u3002\u7531\u4e8e\u5728\u4e0d\u77e5\u9053q\u548cp\u7684\u60c5\u51b5\u4e0b\u03c6(N)\u96be\u4ee5\u8ba1\u7b97\uff0c\u56e0\u6b64\u5728\u5df2\u77e5N\u548ce\u7684\u60c5\u51b5\u4e0b\uff0c\u8ba1\u7b97d\u662f\u56f0\u96be\u7684\uff0c\u8fd9\u5c31\u4fdd\u8bc1\u4e86RSA\u7b97\u6cd5\u7684\u5b89\u5168\u6027\u3002\u540c\u65f6\uff0c\u7531\u4e8eN\u662f\u4e24\u4e2a\u5927\u7d20\u6570p\u548cq\u7684\u4e58\u79ef\uff0c\u56e0\u6b64\u7834\u89e3RSA\u7b97\u6cd5\u7684\u5173\u952e\u5728\u4e8e\u5206\u89e3N\u4e3ap\u548cq\u4e24\u4e2a\u7d20\u6570\u7684\u4e58\u79ef\uff0c\u8fd9\u662f\u4e00\u4e2a\u6781\u5176\u56f0\u96be\u7684\u95ee\u9898\uff0c\u56e0\u6b64RSA\u7b97\u6cd5\u88ab\u8ba4\u4e3a\u662f\u4e00\u79cd\u5b89\u5168\u7684\u52a0\u5bc6\u7b97\u6cd5\u3002<\/p>\n\n\n\n<p>\/\/\u901a\u5e38\u8ba4\u4e3aRSA\u7b97\u6cd5\u7684\u5b89\u5168\u6027\u662f\u7531\u201c\u5206\u89e3N\u4e3ap\u548cq\u4e24\u4e2a\u7d20\u6570\u7684\u4e58\u79ef\u7684\u590d\u6742\u5ea6\u201d\u6765\u4fdd\u8bc1\u7684\uff0c\u4f46\u76ee\u524d\u5c1a\u65e0\u6570\u5b66\u8bc1\u660e\u6765\u652f\u6301\u8fd9\u4e2a\u60f3\u6cd5\u3002<\/p>\n\n\n\n<p>\/\/\u6211\u662f\u7b97\u6cd5\u5c0f\u767d\uff0c\u603b\u89c9\u5f97RSA\u7684\u5f31\u70b9\u5728\u4e8e\u7d20\u6570\u7684\u9009\u62e9\uff0c\u76ee\u524d\u5df2\u77e5\u7684\u7d20\u6570\u867d\u7136\u4e0d\u5c11\u4f46\u4e5f\u662f\u6709\u9650\u7684\uff0c\u5982\u679c\u628a\u6240\u6709\u7684\u7d20\u6570\u4e24\u4e24\u4e58\u79ef\u7ed3\u679c\u505aHash\u5b58\u653e\u5728\u952e\u503c\u6570\u636e\u5e93\u4e2d\uff0c\u7136\u540e\u5bf9\u516c\u94a5\u4e2d\u7684N\u8fdb\u884cHash\uff0c\u5e76\u5728\u6570\u636e\u5e93\u4e2d\u505a\u68c0\u7d22\uff0c\u5e94\u8be5\u4e0d\u96be\u627e\u5230q\u548cp\u4e24\u4e2a\u7d20\u6570\u3002<\/p>\n\n\n\n<p>\/\/\u6839\u636e\u6587\u6863 https:\/\/nvlpubs.nist.gov\/nistpubs\/FIPS\/NIST.FIPS.186-4.pdf  \uff0c RSA\u4f1a\u968f\u673a\u751f\u6210\u8d28\u6570\uff0c\u4f46\u53d7\u9650\u4e8e\u751f\u6210\u548c\u6821\u9a8c\u5927\u7d20\u6570\u7684\u7b97\u6cd5\u590d\u6742\u5ea6\uff0cRSA\u4ee3\u7801\u4e5f\u4f1a\u63a5\u53d7Probable Prime Number \u53ef\u80fd\u7684\u8d28\u6570\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RSA\u52a0\u5bc6\u7b97\u6cd5\u662f\u4e00\u79cd\u516c\u94a5\u52a0\u5bc6\u7b97\u6cd5\uff0c\u7531Ron Rivest\u3001Adi Shamir\u548cLeonard Adleman [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=\/wp\/v2\/posts\/40"}],"collection":[{"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=40"}],"version-history":[{"count":4,"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=\/wp\/v2\/posts\/40\/revisions"}],"predecessor-version":[{"id":46,"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=\/wp\/v2\/posts\/40\/revisions\/46"}],"wp:attachment":[{"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.oldjiang.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}