{"id":346816,"date":"2023-03-16T09:02:29","date_gmt":"2023-03-16T09:02:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=346816"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2023-03-16T09:02:29","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=346816","title":{"rendered":"<span>\u041a\u0430\u043a \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435\u0440 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c CSR \u0443\u0447\u0438\u043b\u0441\u044f<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u043f\u044b\u0442 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f Certificate Signing Request (CSR) \u0444\u043e\u0440\u043c\u0430\u0442\u0430. \u041e \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PEM, DER, \u043a\u0430\u043a\u043e\u0432\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439, \u0441\u0430\u043c\u043e\u0433\u043e CSR \u0444\u0430\u0439\u043b\u0430 \u0438 \u0441\u0430\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0435 &#8212; \u043a\u0430\u043a \u044d\u0442\u043e\u0442 CSR \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0418\u0442\u0430\u043a&#8230;<\/p>\n<h2>0. \u0421 \u0447\u0435\u0433\u043e \u0432\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c<\/h2>\n<p>\u0415\u0441\u0442\u044c \u0443 \u043c\u0435\u043d\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 Web-\u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u043e\u043b\u0433\u0438\u0435 \u0433\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043e\u043d \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043b\u0438\u0448\u044c HTTP, \u043d\u043e \u0432\u043e\u0442 \u0440\u0435\u0448\u0438\u043b \u044f \u043e\u0431\u0443\u0437\u0434\u0430\u0442\u044c SSL \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u043e\u0442 Let&#8217;s Encrypt, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u043e\u0432 \u043d\u0430 \u043d\u0451\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u0438 PWA, \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0440\u0430\u0434\u043e\u0441\u0442\u0438 HTTPS \u0436\u0438\u0437\u043d\u0438.<\/p>\n<p>\u041f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0432\u0435\u0447\u0435\u0440-\u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430 \u043f\u043e\u0434\u0431\u043e\u0440 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 ACME \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043a\u043e\u0438\u043c \u0441\u0442\u0430\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 bash <a href=\"https:\/\/github.com\/sinclair2\/bacme\" rel=\"noopener noreferrer nofollow\">bacme<\/a>, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u044b \u0441 HTTP \u043d\u0430 HTTPS &#8212; \u0438 \u0432\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043c\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0442 \u0436\u0435\u043b\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043c\u043e\u0447\u0435\u043a \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0430\u0437\u0434\u0430\u0451\u0442 \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u0442\u0440\u0438 \u043c\u0435\u0441\u044f\u0446\u0430, \u043d\u0443\u0436\u043d\u043e \u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u0438\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c. \u0421 \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u044f \u043f\u043e\u043b\u0435\u0437 \u0432 <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc8555.txt\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e ACME \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/a> \u0438 \u043d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442. \u0414\u0435\u0442\u0430\u043b\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043a\u043b\u044e\u0447\u0438 \u0438 JWS \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u043e\u043f\u0443\u0449\u0443. \u0421\u0430\u043c\u0430\u044f \u0432\u0435\u0441\u0451\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u0430\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u044f \u0440\u0435\u0448\u0438\u043b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 CSR.<\/p>\n<h2>1. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 PEM \u0438 DER \u0432 \u0446\u0435\u043b\u043e\u043c, \u0438 CSR \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p>\u041e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443<\/p>\n<h3>1.1. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PEM<\/h3>\n<p>Privacy-Enhanced Mail &#8212; \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u043c\u0435\u043d\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u043e\u0439 (\u0438\u0431\u043e \u0441\u0430\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442).<\/p>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u0430\u0441 \u043d\u0435 \u0440\u0430\u0437 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0430\u0440\u044b \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445\/\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 openssl. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043e\u0434\u043d\u0443 \u043f\u0430\u0440\u0443 \u0438 \u0431\u0443\u0434\u0435\u043c \u0434\u0430\u043b\u0435\u0435 \u043e\u0442 \u043d\u0438\u0445 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f:<\/p>\n<pre><code class=\"bash\">$ openssl genrsa 512 > private.key $ cat private.key | openssl rsa -pubout > public.key<\/code><\/pre>\n<p>\u0414\u043b\u0438\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f, \u0447\u0442\u043e\u0431\u044b \u0438 \u043c\u0435\u0441\u0442\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u043e, \u043d\u043e \u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f CSR \u0445\u0432\u0430\u0442\u0430\u043b\u043e. \u0412 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0440\u0430\u0437\u043c\u0435\u0440 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u0449\u0435.<\/p>\n<p>\u0418\u0442\u043e\u0433\u043e \u0438\u043c\u0435\u0435\u043c<\/p>\n<pre><code>-----BEGIN RSA PRIVATE KEY----- MIIBPAIBAAJBAK1RiSg7+E2s2tyCtj\/63IXk9F8nT44+PBOyoB8rfyztkUWA\/zhA jYzVO+DHl\/cccA996OaW5xxDz2LeX2D6cokCAwEAAQJBAIw1+\/l6mmNsRRpC\/GFB 9oizMiaQTMHMAxoEVZkhvR6ANBZdMqMh0Zg5gQ8UgOiQcPXKK9KjtmVLqNsYiFx8 3gkCIQDlA\/DOMvkqBimYXWdnhgv\/H\/YMv9ZCyTxtWPgQZJz\/3wIhAMG9i2WQNCN\/ 0XqLglY3DqM4FDpN3bHyFLp0laU6eTqXAiAfV3e4MH+rAablpDrHjy\/LHYul2Qcw oquzZ06jp7FYzwIhAKAXCfrQn+S9l9FVOkwXjqbcjgpnkUubJ\/myoH05xjbdAiEA zAkmtBlPsk6InUsepCYFp5CLJJ22h6n5QUtp3yDdnb4= -----END RSA PRIVATE KEY-----<\/code><\/pre>\n<pre><code>-----BEGIN PUBLIC KEY----- MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAK1RiSg7+E2s2tyCtj\/63IXk9F8nT44+ PBOyoB8rfyztkUWA\/zhAjYzVO+DHl\/cccA996OaW5xxDz2LeX2D6cokCAwEAAQ== -----END PUBLIC KEY-----<\/code><\/pre>\n<p>\u0412\u0440\u044f\u0434 \u043b\u0438 \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0435\u0447\u0442\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432 base64 \u043c\u0435\u0436\u0434\u0443 \u0445\u0435\u0434\u0435\u0440\u043e\u043c \u0438 \u0444\u0443\u0442\u0435\u0440\u043e\u043c \u0432\u0438\u0434\u0430 <code>-----BEGIN [TYPE]-----<\/code> \u0438 <code>-----END [TYPE]-----<\/code> &#8212; \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c PEM \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440. \u041f\u043e \u0441\u0443\u0442\u0438, \u0442\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u0438\u0434\u0430, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u0435\u043d\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0432\u0441\u044f\u043a\u0438\u0435 \u043a\u0440\u0438\u043f\u0442\u043e-\u043d\u0438\u0448\u0442\u044f\u043a\u0438, \u0430 \u044d\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 DER \u0444\u043e\u0440\u043c\u0430\u0442\u0435.<\/p>\n<h3>1.2. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 DER<\/h3>\n<p>Distinguished Encoding Rules &#8212; \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f ASN.1 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0448 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 (\u043e\u043d \u0441\u0430\u043c\u044b\u0439 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439) \u0438\u0437 base64 \u0432 HEX<\/p>\n<pre><code>30 5c 30 0d 06 09 2a 86  48 86 f7 0d 01 01 01 05 00 03 4b 00 30 48 02 41  00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc  85 e4 f4 5f 27 4f 8e 3e 3c 13 b2 a0 1f 2b 7f 2c  ed 91 45 80 ff 38 40 8d 8c d5 3b e0 c7 97 f7 1c  70 0f 7d e8 e6 96 e7 1c 43 cf 62 de 5f 60 fa 72  89 02 03 01 00 01<\/code><\/pre>\n<p>DER \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u043c\u0435\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 TLV (Type, Length, Value). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Type &#8212; \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442, Length &#8212; \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0438 \u0432\u044b\u0448\u0435 (\u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0440\u0451\u0445 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b, \u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0434\u043e 128 \u0431\u0430\u0439\u0442), Value &#8212; &lt;Length> \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0431\u0430\u0439\u0442.<\/p>\n<p>\u0412\u0441\u0435 \u0442\u0438\u043f\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u043d\u043e \u043d\u0430\u0441 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">02<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">INTEGER<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0426\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">03<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">BIT STRING<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0438\u0442\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">04<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">OCTET STRING<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0439\u0442\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">05<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">NULL<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0443\u0441\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">06<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">OBJECT<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0431\u044a\u0435\u043a\u0442 \u0432 OID \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">0c<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">UTF8 STRING<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u043e\u043a\u0430 \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 UTF8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">30<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">SEQUENCE<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">31<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">SET<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0414\u043b\u0438\u043d\u0430 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443:<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043c\u0435\u0436\u0434\u0443 0 \u0438 127 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u043e \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0431\u0430\u0439\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0438\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 (\u0442\u043e \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 > 127), \u0442\u043e \u043c\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u044d\u0442\u0443 \u0435\u0434\u0438\u043d\u0438\u0446\u0443, \u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8212; \u044d\u0442\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0431\u0430\u0439\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u044b, \u0432\u044b\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443. \u042f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <span>\u044d\u0442\u0438\u043c <\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/seccertenroll\/about-der-encoding-of-asn-1-types\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c<\/a>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u043a\u043b\u044e\u0447 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u0438\u0434\u0435:<\/p>\n<pre><code>30 5c (SEQUENSE - 92)   30 0d (SEQUENCE - 13)     06 09 (OBJECT - 9)       2a 86 48 86 f7 0d 01 01 01 (rsaEncryption)     05 00 (NULL - 0)   03 4b (BIT STRING - 75)     00 30 48 02 41 00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc ...<\/code><\/pre>\n<p>\u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0432\u0448\u0438\u0441\u044c, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 BIT STRING \u0432\u043f\u043e\u043b\u043d\u0435 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c:<\/p>\n<pre><code>30 48 (SEQUENCE - 72)   02 41 (INTEGER - 65),     00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f ... (\u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0431\u0430\u0437\u0435 10 \u043d\u0435 \u0431\u0443\u0434\u0443)   02 03 (INTEGER - 3),     01 00 01 (65537)<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u044e\u0447\u0435 modulus \u0438 exponent. \u0422\u0435 \u0441\u0430\u043c\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>openssl rsa -pubin -text<\/code>. \u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430:<\/p>\n<pre><code>30 82 01 3c (SEQUENCE - 316)   02 01 (INTEGER - 1)     00 (0)   02 41 (INTEGER - 65)     00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc 85 e4 f4 5f 27 4f 8e 3e 3c 13 b2 a0 1f 2b 7f 2c  ...   02 03 (INTEGER - 3)     01 00 01 (65537)   02 41 (INTEGER - 65)     00 8c 35 fb f9 7a 9a 63 6c 45 1a 42 fc 61 41 f6 88 b3 32 26 90 4c c1 cc 03 1a 04 55 99 21 bd 1e  ...   02 21 (INTEGER - 33)     00 e5 03 f0 ce 32 f9 2a 06 29 98 5d 67 67 86 0b ff 1f f6 0c bf d6 42 c9 3c 6d 58 f8 10 64 9c ff  ...   02 21 (INTEGER - 33)     00 c1 bd 8b 65 90 34 23 7f d1 7a 8b 82 56 37 0e a3 38 14 3a 4d dd b1 f2 14 ba 74 95 a5 3a 79 3a  ...   02 20 (INTEGER - 32)     1f 57 77 b8 30 7f ab 01 a6 e5 a4 3a c7 8f 2f cb 1d 8b a5 d9 07 30 a2 ab b3 67 4e a3 a7 b1 58 cf   02 21 (INTEGER - 33)     00 a0 17 09 fa d0 9f e4 bd 97 d1 55 3a 4c 17 8e a6 dc 8e 0a 67 91 4b 9b 27 f9 b2 a0 7d 39 c6 36  ...   02 21 (INTEGER - 33)     00 cc 09 26 b4 19 4f b2 4e 88 9d 4b 1e a4 26 05 a7 90 8b 24 9d b6 87 a9 f9 41 4b 69 df 20 dd 9d  ...<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0430\u0448\u0438 modulus \u0438 exponent, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u043a \u0440\u0430\u0437 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 public.key \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (`openssl rsa -pubout`):<\/p>\n<pre><code>  02 41 (INTEGER - 65)     00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc 85 e4 f4 5f 27 4f 8e 3e 3c 13 b2 a0 1f 2b 7f 2c  ...   02 03 (INTEGER - 3)     01 00 01 (65537)<\/code><\/pre>\n<p>\u041f\u043b\u044e\u0441 \u043f\u0440\u043e\u0447\u0438\u0435 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435\u0441\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043e\u043d\u0438 \u0432\u043d\u043e\u0432\u044c \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0437\u0430 \u0441\u043a\u043e\u0443\u043f \u043c\u043e\u0435\u0433\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f. \u0421\u0435\u0439\u0447\u0430\u0441 \u0436\u0435, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0435\u043c\u0435 \u043c\u043e\u0438\u0445 \u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439:<\/p>\n<h3>1.3. \u0418\u0437 \u0447\u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u043d CSR<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e `openssl`:<\/p>\n<pre><code>openssl req -sha256 -new -key private.key -subj \"\/CN=asd\" > req.csr<\/code><\/pre>\n<pre><code>-----BEGIN CERTIFICATE REQUEST----- MIHHMHMCAQAwDjEMMAoGA1UEAwwDYXNkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJB AK1RiSg7+E2s2tyCtj\/63IXk9F8nT44+PBOyoB8rfyztkUWA\/zhAjYzVO+DHl\/cc cA996OaW5xxDz2LeX2D6cokCAwEAAaAAMA0GCSqGSIb3DQEBCwUAA0EAMKHzrPNG tceXiSuFt4laz0nFvt8psAcjhL\/Ke3Zf\/xDvLIum1Li7Q26qoRAqst90+Ux+I61w VqrwHTo2lEzU+Q== -----END CERTIFICATE REQUEST-----<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0435\u0433\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443<\/p>\n<pre><code>30 81 c7 (SEQUENCE - 199)   30 73 (SEQUENCE - 115)     02 01 (INTEGER - 1) \/\/ Version       00 (0)     30 0e (SEQUENCE - 14) \/\/ Subject       31 0c (SET - 12)         30 0a (SEQUENCE - 10)           06 03 (OBJECT - 3)             55 04 03 (commonName)           0c 03 (UTF8 - 3)             61 73 64 (asd)     30 5c (SEQUENCE - 92) \/\/ RSA Public Key       30 0d (SEQUENCE - 13)         06 09 (OBJECT - 9)           2a 86 48 86 f7 0d 01 01 01 (rsaEncryption)         05 00 (NULL - 0)       03 4b (BIT - 75)         00 30 48 02 41 00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc 85 e4 f4 5f 27 4f 8e 3e 3c 13 b2  ...     a0 00 (BER - 0) \/\/ Extended attribute list   30 0d (SEQUENCE - 13)     06 09 (OBJECT - 9) \/\/ Signature algorithm       2a 86 48 86 f7 0d 01 01 0b (sha256WithRSAEncryption)     05 00 (NULL - 0)   03 41 (BIT - 65) \/\/ Signature     00 30 a1 f3 ac f3 46 b5 c7 97 89 2b 85 b7 89 5a cf 49 c5 be df 29 b0 07 23 84 bf ca 7b 76 5f ff  ...<\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>Version &#8212; \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 0.<\/p>\n<\/li>\n<li>\n<p>Subject &#8212; \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0432\u0440\u043e\u0434\u0435 commonName, countryName \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043f\u043e\u043b\u044f \u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e CA.<\/p>\n<\/li>\n<li>\n<p>RSA Public Key &#8212; \u0442\u043e\u0447\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430<\/p>\n<\/li>\n<li>\n<p>Extended attribute list &#8212; \u0413\u0440\u0443\u043f\u043f\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 `Subject Alternative Names` (\u041d\u0435 \u0438\u0437\u0443\u0447\u0430\u043b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0435\u0449\u0451)<\/p>\n<\/li>\n<li>\n<p>Signature algorithm &#8212; \u0421\u043e\u043e\u0431\u0449\u0430\u0435\u043c CA, \u043a\u0430\u043a\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441<\/p>\n<\/li>\n<li>\n<p>Signature &#8212; \u0441\u0430\u043c\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044c<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u043b\u0435\u0439 \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u0430: \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u0438 \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c CA. \u041d\u043e \u0432\u043e\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044c&#8230;<\/p>\n<h2>2. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c CSR<\/h2>\n<p>(\u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0443\u043a\u0438, \u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0441\u0443\u0445\u0438\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f &#8212; \u0441\u043c\u0435\u043b\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0439\u0442\u0435 \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c)<\/p>\n<p>\u041f\u0440\u043e\u0432\u043e\u0437\u0438\u043b\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u043e\u043c \u044f \u043e\u043a\u043e\u043b\u043e \u043d\u0435\u0434\u0435\u043b\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0432\u0435\u0447\u0435\u0440\u043e\u0432 \u0432 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445 \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c, \u043b\u0438\u0431\u043e \u0441\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c. \u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e, \u0433\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a\u0443\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e, \u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u043e \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 CSR, \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b \u0432 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0447\u0430\u0442\u0430\u0445 \u043f\u043e \u0431\u044d\u043a\u0435\u043d\u0434\u0435\u0440\u0430\u043c &#8212; \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0438\u043a\u0442\u043e. \u041f\u043e\u0448\u0451\u043b \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430 StackOverflow, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0431\u0443\u044f \u0435\u0449\u0451 \u0440\u0430\u0437.<\/p>\n<p>\u0421\u0430\u043c \u0432\u043e\u043f\u0440\u043e\u0441 \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u043d\u043e, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u043e\u043b\u043e\u0436\u0443 \u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440, \u0430 \u0434\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u0436\u0443 \u043d\u0430 \u0440\u043e\u0434\u043d\u043e\u043c \u0440\u0443\u0441\u0441\u043a\u043e\u043c, \u043e\u043f\u0443\u0441\u0442\u0438\u0432 \u0432\u0441\u0451 \u0442\u043e, \u0447\u0442\u043e \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0428\u0430\u0431\u043b\u043e\u043d \u043d\u0435\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 StackOverflow<\/summary>\n<div class=\"spoiler__content\">\n<p>I&#8217;m diving into cryptography algorithms with current task of getting certificates from <code>Let's Encrypt<\/code> by ACME protocol. At a step of generating Certificate Signing Request (CSR) I&#8217;ve encountered behaviour I can&#8217;t understand: how document signature is generated and why signature generated by me doesn&#8217;t match the one generated by <code>openssl req -new<\/code>.<\/p>\n<p>For my test I&#8217;ve generated key pair:<\/p>\n<pre><code>$ openssl genrsa 512 > private.key  -----BEGIN RSA PRIVATE KEY----- MIIBPAIBAAJBAK1RiSg7+E2s2tyCtj\/63IXk9F8nT44+PBOyoB8rfyztkUWA\/zhA jYzVO+DHl\/cccA996OaW5xxDz2LeX2D6cokCAwEAAQJBAIw1+\/l6mmNsRRpC\/GFB 9oizMiaQTMHMAxoEVZkhvR6ANBZdMqMh0Zg5gQ8UgOiQcPXKK9KjtmVLqNsYiFx8 3gkCIQDlA\/DOMvkqBimYXWdnhgv\/H\/YMv9ZCyTxtWPgQZJz\/3wIhAMG9i2WQNCN\/ 0XqLglY3DqM4FDpN3bHyFLp0laU6eTqXAiAfV3e4MH+rAablpDrHjy\/LHYul2Qcw oquzZ06jp7FYzwIhAKAXCfrQn+S9l9FVOkwXjqbcjgpnkUubJ\/myoH05xjbdAiEA zAkmtBlPsk6InUsepCYFp5CLJJ22h6n5QUtp3yDdnb4= -----END RSA PRIVATE KEY-----  $ cat private.key | openssl rsa -pubout > public.key  -----BEGIN PUBLIC KEY----- MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAK1RiSg7+E2s2tyCtj\/63IXk9F8nT44+ PBOyoB8rfyztkUWA\/zhAjYzVO+DHl\/cccA996OaW5xxDz2LeX2D6cokCAwEAAQ== -----END PUBLIC KEY----- <\/code><\/pre>\n<p>Then generated CSR signed by private.key:<\/p>\n<pre><code>openssl req -sha256 -new -key private.key -subj \"\/CN=asd\" > req.csr <\/code><\/pre>\n<p><a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc2986\" rel=\"noopener noreferrer nofollow\">Documentation of CSR<\/a>:<\/p>\n<pre><code> The signature process consists of two steps:          1. The value of the certificationRequestInfo component is DER            encoded, yielding an octet string.          2. The result of step 1 is signed with the certification request            subject's private key under the specified signature            algorithm, yielding a bit string, the signature.     Note - An equivalent syntax for CertificationRequest could be    written:     CertificationRequest ::= SIGNED { EncodedCertificationRequestInfo }         (CONSTRAINED BY { -- Verify or sign encoded          -- CertificationRequestInfo -- })     EncodedCertificationRequestInfo ::=         TYPE-IDENTIFIER.&amp;Type(CertificationRequestInfo)     SIGNED { ToBeSigned } ::= SEQUENCE {         toBeSigned ToBeSigned,         algorithm  AlgorithmIdentifier { {SignatureAlgorithms} },         signature  BIT STRING    } <\/code><\/pre>\n<p>I&#8217;ve got my utility to parse and read PEM with DER and ASN.1, so I&#8217;ve extracted all parts of req.csr (converted to HEX):<\/p>\n<pre><code>toBeSigned (all data without header (type + length)): 020100300e310c300a06035504030c03617364305c300d06092a864886f70d0101010500034b003048024100ad5189283bf84dacdadc82b63ffadc85e4f45f274f8e3e3c13b2a01f2b7f2ced914580ff38408d8cd53be0c797f71c700f7de8e696e71c43cf62de5f60fa72890203010001a000  algorithm (simply: sha256WithRSAEncryption): 06092a864886f70d01010b0500  signature (BIT STRING, so I trimmed first 0x00 byte): 30a1f3acf346b5c797892b85b7895acf49c5bedf29b0072384bfca7b765fff10ef2c8ba6d4b8bb436eaaa1102ab2df74f94c7e23ad7056aaf01d3a36944cd4f9 <\/code><\/pre>\n<p>Now where is fun part begins. For my experiments I&#8217;m using NodeJS built-in <code>crypto<\/code> library.<\/p>\n<p>My main goal is to generate signature myself, so let&#8217;s try doing it right away.<\/p>\n<pre><code>const privateKey = fs.readFileSync('.\/private.key'); const sign = crypto.createSign('SHA256'); \/\/ 'sha256WithRSAEncryption' yields same result sign.update(toBeSigned); console.log(sign.sign(privateKey).toString('hex'));  \/\/ 257ea64e1e26ff56a13941aa8dc2f3920ce160ef8229d3096f71d41743f1072da7f6cf6471eab78fac73667ea349f73b34e022c2ed420c538a01d833656b018a <\/code><\/pre>\n<p>That doesn&#8217;t really match signature generated by openssl.<\/p>\n<p>Tried to do straight forward as I understand from documentation (mentioned above):<\/p>\n<pre><code>const hash = crypto.createHash('SHA256'); hash.update(toBeSigned); console.log(crypto.privateEncrypt(privateKey, hash.digest()).toString('hex'));  \/\/ 22f7dfb2d78a7d782526bdb5a209d8829ea15b21c694d6beaf057c4f267d4c10b15572cd63cfb86429b9b019216a1e214d05b62a90121f2e174cd5b2357dbe2c <\/code><\/pre>\n<p>This doesn&#8217;t match neither CSR signature, nor output of my first attempt.<\/p>\n<p>Ok, let&#8217;s just try to verify signature.<\/p>\n<pre><code>const publicKey = extractPublicKey(toBeSigned); \/\/ ensured that it's matched openssl generated public.key mentioned above  const verify = crypto.createVerify('SHA256'); \/\/ or 'sha256WithRSAEncryption' - same result verify.update(toBeSigned); console.log(verify.verify(publicKey, signature));  \/\/ false <\/code><\/pre>\n<p>Let&#8217;s just try to decrypt signature, if it actually encrypted SHA256 hash.<\/p>\n<pre><code>const hash = crypto.createHash('SHA256'); hash.update(toBeSigned); console.log('HASH:', hash.digest().toString('hex')); const decrypt = crypto.publicDecrypt(publicKey, signature); console.log('DECRYPT:', decrypt.toString('hex'));  \/\/ HASH: 1dadbc87fb115c377a9c7055739b6bf71666cd3d6f13923406e321addef9f4a9 \/\/ DECRYPT: 3031300d060960864801650304020105000420d55d923fe33e4dcb1446bf8680763c49583c59d71a81adafdd611f4aa5fe2b10 <\/code><\/pre>\n<p>Needless to say they doesn&#8217;t match. Also the length of decrypted sign is far from 256 bits. I sliced first 19 bytes (that exceeded 256 bits) to take a closer look.<\/p>\n<pre><code>30 31 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 04 20 <\/code><\/pre>\n<p>It&#8217;s definitely looks like DER encoded line<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc2986\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a><\/p>\n<pre><code> The signature process consists of two steps:          1. The value of the certificationRequestInfo component is DER            encoded, yielding an octet string.          2. The result of step 1 is signed with the certification request            subject's private key under the specified signature            algorithm, yielding a bit string, the signature.     Note - An equivalent syntax for CertificationRequest could be    written:     CertificationRequest ::= SIGNED { EncodedCertificationRequestInfo }         (CONSTRAINED BY { -- Verify or sign encoded          -- CertificationRequestInfo -- })     EncodedCertificationRequestInfo ::=         TYPE-IDENTIFIER.&amp;Type(CertificationRequestInfo)     SIGNED { ToBeSigned } ::= SEQUENCE {         toBeSigned ToBeSigned,         algorithm  AlgorithmIdentifier { {SignatureAlgorithms} },         signature  BIT STRING    }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0438\u0437 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<pre><code>toBeSigned (\u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a): 020100300e310c300a06035504030c03617364305c300d06092a864886f70d0101010500034b003048024100ad5189283bf84dacdadc82b63ffadc85e4f45f274f8e3e3c13b2a01f2b7f2ced914580ff38408d8cd53be0c797f71c700f7de8e696e71c43cf62de5f60fa72890203010001a000  algorithm (\u043f\u0440\u043e\u0441\u0442\u043e: sha256WithRSAEncryption): 06092a864886f70d01010b0500  signature (BIT STRING, \u0442\u0430\u043a \u0447\u0442\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e \u043f\u0435\u0440\u0432\u044b\u0439 0x00 \u0431\u0430\u0439\u0442): 30a1f3acf346b5c797892b85b7895acf49c5bedf29b0072384bfca7b765fff10ef2c8ba6d4b8bb436eaaa1102ab2df74f94c7e23ad7056aaf01d3a36944cd4f9<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e NodeJS \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0432 \u043d\u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <code>crypto<\/code>. \u041c\u043e\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c &#8212; \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u0441 \u044d\u0442\u043e\u0433\u043e \u0438 \u043d\u0430\u0447\u043d\u0443<\/p>\n<pre><code class=\"javascript\">const privateKey = fs.readFileSync('.\/private.key'); const sign = crypto.createSign('SHA256'); \/\/ 'sha256WithRSAEncryption' yields same result sign.update(toBeSigned); console.log(sign.sign(privateKey).toString('hex'));  \/\/ 257ea64e1e26ff56a13941aa8dc2f3920ce160ef8229d3096f71d41743f1072da7f6cf6471eab78fac73667ea349f73b34e022c2ed420c538a01d833656b018a<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c (\u0421\u041f\u041e\u0419\u041b\u0415\u0420)<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0443, \u0447\u0442\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a (30 72) \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d. \u0415\u0441\u043b\u0438 \u0431\u044b \u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b \u0441 \u043d\u0438\u043c, \u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0440\u043e\u0432\u043d\u043e \u0442\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044c, \u0447\u0442\u043e \u0438 \u0432 CSR.<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044c, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e <code>openssl<\/code>. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431:<\/p>\n<pre><code class=\"javascript\">const hash = crypto.createHash('SHA256'); hash.update(toBeSigned); console.log(crypto.privateEncrypt(privateKey, hash.digest()).toString('hex'));  \/\/ 22f7dfb2d78a7d782526bdb5a209d8829ea15b21c694d6beaf057c4f267d4c10b15572cd63cfb86429b9b019216a1e214d05b62a90121f2e174cd5b2357dbe2c<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c (\u0421\u041f\u041e\u0419\u041b\u0415\u0420)<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u0435\u0448 \u043a\u043b\u044e\u0447\u043e\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0426\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0432 DER \u0444\u043e\u0440\u043c\u0430\u0442\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0438 \u043d\u0435 \u0441\u043e\u0448\u043b\u0430\u0441\u044c \u043d\u0438 \u0441 \u0438\u0441\u043a\u043e\u043c\u043e\u0439, \u043d\u0438 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c. \u041a\u0430\u043a \u044d\u0442\u0430 \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 &#8212; \u043d\u0438\u0436\u0435 \u043e\u043f\u0438\u0448\u0443.<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043d\u0438 \u0441 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e, \u043d\u0438 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u0420\u0435\u0448\u0438\u043b \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u0430 \u0435\u0445\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"javascript\">const publicKey = extractPublicKey(toBeSigned); \/\/ \u0443\u0434\u043e\u0441\u0442\u0430\u0432\u0435\u0440\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043d\u0430\u0448\u0438\u043c public.key, \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u043c \u0432\u044b\u0448\u0435  const verify = crypto.createVerify('SHA256'); \/\/ 'sha256WithRSAEncryption' - \u0442\u043e\u0442 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 verify.update(toBeSigned); console.log(verify.verify(publicKey, signature));  \/\/ false<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u0440\u0430\u0437 \u0443\u0436 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SHA256 \u0445\u0435\u0448.<\/p>\n<pre><code class=\"javascript\">const hash = crypto.createHash('SHA256'); hash.update(toBeSigned); console.log('HASH:', hash.digest().toString('hex')); const decrypt = crypto.publicDecrypt(publicKey, signature); console.log('DECRYPT:', decrypt.toString('hex'));  \/\/ HASH: 1dadbc87fb115c377a9c7055739b6bf71666cd3d6f13923406e321addef9f4a9 \/\/ DECRYPT: 3031300d060960864801650304020105000420d55d923fe33e4dcb1446bf8680763c49583c59d71a81adafdd611f4aa5fe2b10<\/code><\/pre>\n<p>\u0418\u0437\u043b\u0438\u0448\u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u0438\u043d\u043d\u0435\u0435 256 \u0431\u0438\u0442, \u0430 \u0435\u0451 \u043d\u0430\u0447\u0430\u043b\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439. \u041e\u0442\u0440\u0435\u0436\u0435\u043c \u0432\u0441\u0435 \u043f\u0435\u0440\u0432\u044b\u0435 \u0431\u0438\u0442\u044b, \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0449\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 SHA256 32 \u0431\u0430\u0439\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043d\u0438\u0445 \u043f\u043e\u0431\u043b\u0438\u0436\u0435.<\/p>\n<pre><code>30 31 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 00 04 20<\/code><\/pre>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435\u0447\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0441\u043e\u043b\u0438, \u043d\u043e \u0440\u0430\u0441\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0432 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0441 \u0434\u0435\u0441\u044f\u0442\u043e\u043a-\u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0441\u044f\u043a\u0438\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 CSR-\u043e\u0432, \u0438 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0432 \u043d\u0430 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0441\u0432\u0435\u0436\u0438\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u0443\u043b\u043e\u0432\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u043e\u0436\u0435 DER \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430!<\/p>\n<pre><code>30 31 (SEQUENCE - 49)   30 0d (SEQUENCE - 13)     06 09 (OBJECT - 9)       60 86 48 01 65 03 04 02 01 (sha256)     05 00 (NULL - 0)   04 20 (OCTET - 32)     d5 5d 92 3f e3 3e 4d cb 14 46 bf 86 80 76 3c 49 58 3c 59 d7 1a 81 ad af dd 61 1f 4a a5 fe 2b 10<\/code><\/pre>\n<p>\u0418 \u0432\u043e\u0442 \u043e\u043d, \u043d\u0430\u0448 \u0445\u0435\u0448! \u0412\u0441\u0435 256 \u0431\u0438\u0442 (32 \u0431\u0430\u0439\u0442\u0430). \u041d\u0435\u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u043d\u0435 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u044c, \u043d\u0438\u043a\u0442\u043e, \u0434\u0443\u043c\u0430\u044e, \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a \u0437\u0430\u0432\u0451\u0440\u043d\u0443\u0442\u0430. \u0412\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043d\u0430\u0448\u0438\u043c \u0445\u0435\u0448\u0435\u043c \u043e\u043d\u0430 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442&#8230; <\/p>\n<p>\u0412\u0435\u0440\u043d\u0443\u0432\u0448\u0438\u0441\u044c \u043a \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0438 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u043d\u0430 \u043d\u0438\u0445 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432, \u044f \u0443\u0432\u0438\u0434\u0435\u043b, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u0431\u044b\u043b\u0430 \u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438.<\/p>\n<pre><code>toBeSigned (\u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a): 020100300e310c300a06035504030c03617364305c300d06092a864886f70d0101010500034b003048024100ad5189283bf84dacdadc82b63ffadc85e4f45f274f8e3e3c13b2a01f2b7f2ced914580ff38408d8cd53be0c797f71c700f7de8e696e71c43cf62de5f60fa72890203010001a000<\/code><\/pre>\n<p>\u0410 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a-\u0442\u043e \u0432\u0441\u0451 \u0436\u0435 \u043d\u0443\u0436\u0435\u043d? \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0432 \u043d\u0430\u0447\u0430\u043b\u043e <code>3073<\/code>, \u0445\u044d\u0448\u0438\u0440\u0443\u044e \u0432 SHA256 \u0438 &#8212; \u0412\u0443\u0430\u043b\u044f!<\/p>\n<pre><code class=\"javascript\">hash.digest().toString('hex') \/\/ 'd55d923fe33e4dcb1446bf8680763c49583c59d71a81adafdd611f4aa5fe2b10'<\/code><\/pre>\n<h2>3. \u041a\u0430\u043a \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c-\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435?<\/h2>\n<p>\u0418\u0442\u043e\u0433 \u043c\u043e\u0438\u0445 \u043c\u0443\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c.<\/p>\n<ol>\n<li>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c CSR, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u0442\u0443 \u0447\u0430\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c (\u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u043c (\u0422\u0438\u043f 30 + \u0434\u043b\u0438\u043d\u0430)):<\/p>\n<\/li>\n<\/ol>\n<pre><code>3073020100300e310c300a06035504030c03617364305c300d06092a864886f70d0101010500034b003048024100ad5189283bf84dacdadc82b63ffadc85e4f45f274f8e3e3c13b2a01f2b7f2ced914580ff38408d8cd53be0c797f71c700f7de8e696e71c43cf62de5f60fa72890203010001a000<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430 DER<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>30 73 (SEQUENCE - 115)   02 01 (INTEGER - 1) \/\/ Version     00 (0)   30 0e (SEQUENCE - 14) \/\/ Subject     31 0c (SET - 12)       30 0a (SEQUENCE - 10)         06 03 (OBJECT - 3)           55 04 03 (commonName)         0c 03 (UTF8 - 3)           61 73 64 (asd)   30 5c (SEQUENCE - 92) \/\/ RSA Public Key     30 0d (SEQUENCE - 13)       06 09 (OBJECT - 9)         2a 86 48 86 f7 0d 01 01 01 (rsaEncryption)       05 00 (NULL - 0)     03 4b (BIT - 75)       00 30 48 02 41 00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc 85 e4 f4 5f 27 4f 8e 3e 3c 13 b2  ...   a0 00 (BER - 0) \/\/ Extended attribute list <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<ol start=\"2\">\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0442\u0438\u043f \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e SHA256, \u0438 \u0437\u0430\u0433\u043e\u043d\u044f\u0435\u043c \u0442\u0443\u0434\u0430 \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<\/li>\n<\/ol>\n<pre><code>d55d923fe33e4dcb1446bf8680763c49583c59d71a81adafdd611f4aa5fe2b10<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0432 DER \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0445\u0435\u0448\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/p>\n<\/li>\n<\/ol>\n<pre><code>3031300d060960864801650304020105000420d55d923fe33e4dcb1446bf8680763c49583c59d71a81adafdd611f4aa5fe2b10<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430 DER<\/summary>\n<div class=\"spoiler__content\">\n<pre><code> 30 31 (SEQUENCE - 49)   30 0d (SEQUENCE - 13)     06 09 (OBJECT - 9)       60 86 48 01 65 03 04 02 01 (sha256)     05 00 (NULL - 0)   04 20 (OCTET - 32)     d5 5d 92 3f e3 3e 4d cb 14 46 bf 86 80 76 3c 49 58 3c 59 d7 1a 81 ad af dd 61 1f 4a a5 fe 2b 10<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<ol start=\"4\">\n<li>\n<p>\u041d\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u0448\u0438\u0444\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043e\u0431\u0451\u0440\u0442\u043a\u0443, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<\/p>\n<\/li>\n<\/ol>\n<pre><code>30a1f3acf346b5c797892b85b7895acf49c5bedf29b0072384bfca7b765fff10ef2c8ba6d4b8bb436eaaa1102ab2df74f94c7e23ad7056aaf01d3a36944cd4f9<\/code><\/pre>\n<ol start=\"5\">\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a BIT STRING (\u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0442\u0438\u043f\u0430 \u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c 00 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0442\u0440\u043e\u043a\u0438) \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0438:<\/p>\n<\/li>\n<\/ol>\n<pre><code>300d06092a864886f70d01010b0500 03410030a1f3acf346b5c797892b85b7895acf49c5bedf29b0072384bfca7b765fff10ef2c8ba6d4b8bb436eaaa1102ab2df74f94c7e23ad7056aaf01d3a36944cd4f9<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430 DER<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>30 0d (SEQUENCE - 13)   06 09 (OBJECT - 9)     2a 86 48 86 f7 0d 01 01 0b (sha256WithRSAEncryption)   05 00 (NULL - 0) 03 41 (BIT - 65)   00 30 a1 f3 ac f3 46 b5 c7 97 89 2b 85 b7 89 5a cf 49 c5 be df 29 b0 07 23 84 bf ca 7b 76 5f ff  ... <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<ol start=\"6\">\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043a\u043b\u0430\u0434\u0451\u043c \u044d\u0442\u043e \u0432\u0441\u0451 \u043d\u0430 \u043e\u0434\u0438\u043d \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0441 \u043d\u0430\u0448\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u0437\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432 SEQUENCE \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u043e\u0439 &#8212; \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u043e\u0432\u043d\u043e \u0442\u043e\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0438\u0441\u0430\u043d \u0432 \u0447\u0430\u0441\u0442\u0438 1.3 \u044d\u0442\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<\/li>\n<\/ol>\n<h2>4. \u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0442\u043e\u0433\u043e\u0432<\/h2>\n<p>\u0414\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u0441\u0443\u043c\u0435\u043b \u043d\u0430\u0439\u0442\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0430\u043b\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0422\u0443, \u0447\u0442\u043e \u043d\u0430\u0448\u0451\u043b, \u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430, \u043f\u0440\u0438\u0432\u0451\u043b \u0432 \u0432\u0438\u0434\u0435 \u0441\u0441\u044b\u043b\u043e\u043a \u0432 \u0442\u0435\u043a\u0441\u0442\u0435, \u043f\u043b\u044e\u0441 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u043a\u043e\u043d\u0446\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b \u0435\u0449\u0451 \u043d\u0435\u043c\u0430\u043b\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0434\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441 \u0442\u0440\u0443\u0434\u0430\u043c\u0438 \u0434\u043e\u043a\u0430\u043f\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u0434\u0430\u0441\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u043f\u043e\u0438\u0441\u043a\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442 \u0435\u0433\u043e \u0441\u044e\u0434\u0430, \u0438 \u0443 \u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0439\u043c\u0451\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u042d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043e\u0441\u043c\u0435\u043b\u0438\u043b\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0425\u0430\u0431\u0440. \u041e\u0447\u0435\u043d\u044c \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0435\u0451 \u0441\u043e\u0447\u0442\u0443\u0442 \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\/\u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439.<\/p>\n<h3>4.1. \u0415\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0441\u044b\u043b\u043e\u043a<\/h3>\n<p><a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc2986\" rel=\"noopener noreferrer nofollow\">https:\/\/www.rfc-editor.org\/rfc\/rfc2986<\/a> &#8212; \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e CSR \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443<br \/><a href=\"https:\/\/oidref.com\/\" rel=\"noopener noreferrer nofollow\">https:\/\/oidref.com\/<\/a> &#8212; \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e OID<br \/><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/seccertenroll\/about-der-encoding-of-asn-1-types\" rel=\"noopener noreferrer nofollow\">https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/seccertenroll\/about-der-encoding-of-asn-1-types<\/a> &#8212; \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 ASN.1 \u0432 DER \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435<br \/><a href=\"https:\/\/luca.ntop.org\/Teaching\/Appunti\/asn1.html\" rel=\"noopener noreferrer nofollow\">https:\/\/luca.ntop.org\/Teaching\/Appunti\/asn1.html<\/a> &#8212; \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 DER \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043d\u043e \u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u0435\u0441\u0442\u0430\u043c \u0443 \u043c\u0435\u043d\u044f \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b<br \/><a href=\"https:\/\/mbed-tls.readthedocs.io\/en\/latest\/kb\/cryptography\/asn1-key-structures-in-der-and-pem\/\" rel=\"noopener noreferrer nofollow\">https:\/\/mbed-tls.readthedocs.io\/en\/latest\/kb\/cryptography\/asn1-key-structures-in-der-and-pem\/<\/a> &#8212; \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e \u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0439<br \/><a href=\"https:\/\/www.geeksforgeeks.org\/rsa-algorithm-cryptography\/\" rel=\"noopener noreferrer nofollow\">https:\/\/www.geeksforgeeks.org\/rsa-algorithm-cryptography\/<\/a> &#8212; \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0439 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u044d\u0442\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432 \u043a\u043b\u044e\u0447\u0430\u0445 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/722732\/\"> https:\/\/habr.com\/ru\/post\/722732\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u043f\u044b\u0442 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f Certificate Signing Request (CSR) \u0444\u043e\u0440\u043c\u0430\u0442\u0430. \u041e \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PEM, DER, \u043a\u0430\u043a\u043e\u0432\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439, \u0441\u0430\u043c\u043e\u0433\u043e CSR \u0444\u0430\u0439\u043b\u0430 \u0438 \u0441\u0430\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0435 &#8212; \u043a\u0430\u043a \u044d\u0442\u043e\u0442 CSR \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0418\u0442\u0430\u043a&#8230;<\/p>\n<h2>0. \u0421 \u0447\u0435\u0433\u043e \u0432\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c<\/h2>\n<p>\u0415\u0441\u0442\u044c \u0443 \u043c\u0435\u043d\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 Web-\u0441\u0435\u0440\u0432\u0435\u0440. \u0414\u043e\u043b\u0433\u0438\u0435 \u0433\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043e\u043d \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u043b\u0438\u0448\u044c HTTP, \u043d\u043e \u0432\u043e\u0442 \u0440\u0435\u0448\u0438\u043b \u044f \u043e\u0431\u0443\u0437\u0434\u0430\u0442\u044c SSL \u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u043e\u0442 Let&#8217;s Encrypt, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u043e\u0432 \u043d\u0430 \u043d\u0451\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u0438 PWA, \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0440\u0430\u0434\u043e\u0441\u0442\u0438 HTTPS \u0436\u0438\u0437\u043d\u0438.<\/p>\n<p>\u041f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u0432\u0435\u0447\u0435\u0440-\u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430 \u043f\u043e\u0434\u0431\u043e\u0440 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 ACME \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043a\u043e\u0438\u043c \u0441\u0442\u0430\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 bash <a href=\"https:\/\/github.com\/sinclair2\/bacme\" rel=\"noopener noreferrer nofollow\">bacme<\/a>, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u044b \u0441 HTTP \u043d\u0430 HTTPS &#8212; \u0438 \u0432\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043c\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0442 \u0436\u0435\u043b\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043c\u043e\u0447\u0435\u043a \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435.<\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0430\u0437\u0434\u0430\u0451\u0442 \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u0442\u0440\u0438 \u043c\u0435\u0441\u044f\u0446\u0430, \u043d\u0443\u0436\u043d\u043e \u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u0438\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c. \u0421 \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u044f \u043f\u043e\u043b\u0435\u0437 \u0432 <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc8555.txt\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e ACME \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/a> \u0438 \u043d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442. \u0414\u0435\u0442\u0430\u043b\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043a\u043b\u044e\u0447\u0438 \u0438 JWS \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u043e\u043f\u0443\u0449\u0443. \u0421\u0430\u043c\u0430\u044f \u0432\u0435\u0441\u0451\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u0430\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u044f \u0440\u0435\u0448\u0438\u043b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 CSR.<\/p>\n<h2>1. \u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 PEM \u0438 DER \u0432 \u0446\u0435\u043b\u043e\u043c, \u0438 CSR \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438<\/h2>\n<p>\u041e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443<\/p>\n<h3>1.1. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 PEM<\/h3>\n<p>Privacy-Enhanced Mail &#8212; \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u043c\u0435\u043d\u0430 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u043e\u0439 (\u0438\u0431\u043e \u0441\u0430\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442).<\/p>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u0430\u0441 \u043d\u0435 \u0440\u0430\u0437 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0430\u0440\u044b \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0445\/\u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 openssl. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043e\u0434\u043d\u0443 \u043f\u0430\u0440\u0443 \u0438 \u0431\u0443\u0434\u0435\u043c \u0434\u0430\u043b\u0435\u0435 \u043e\u0442 \u043d\u0438\u0445 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f:<\/p>\n<pre><code class=\"bash\">$ openssl genrsa 512 > private.key $ cat private.key | openssl rsa -pubout > public.key<\/code><\/pre>\n<p>\u0414\u043b\u0438\u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f, \u0447\u0442\u043e\u0431\u044b \u0438 \u043c\u0435\u0441\u0442\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u043e, \u043d\u043e \u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f CSR \u0445\u0432\u0430\u0442\u0430\u043b\u043e. \u0412 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0440\u0430\u0437\u043c\u0435\u0440 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u0449\u0435.<\/p>\n<p>\u0418\u0442\u043e\u0433\u043e \u0438\u043c\u0435\u0435\u043c<\/p>\n<pre><code>-----BEGIN RSA PRIVATE KEY----- MIIBPAIBAAJBAK1RiSg7+E2s2tyCtj\/63IXk9F8nT44+PBOyoB8rfyztkUWA\/zhA jYzVO+DHl\/cccA996OaW5xxDz2LeX2D6cokCAwEAAQJBAIw1+\/l6mmNsRRpC\/GFB 9oizMiaQTMHMAxoEVZkhvR6ANBZdMqMh0Zg5gQ8UgOiQcPXKK9KjtmVLqNsYiFx8 3gkCIQDlA\/DOMvkqBimYXWdnhgv\/H\/YMv9ZCyTxtWPgQZJz\/3wIhAMG9i2WQNCN\/ 0XqLglY3DqM4FDpN3bHyFLp0laU6eTqXAiAfV3e4MH+rAablpDrHjy\/LHYul2Qcw oquzZ06jp7FYzwIhAKAXCfrQn+S9l9FVOkwXjqbcjgpnkUubJ\/myoH05xjbdAiEA zAkmtBlPsk6InUsepCYFp5CLJJ22h6n5QUtp3yDdnb4= -----END RSA PRIVATE KEY-----<\/code><\/pre>\n<pre><code>-----BEGIN PUBLIC KEY----- MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAK1RiSg7+E2s2tyCtj\/63IXk9F8nT44+ PBOyoB8rfyztkUWA\/zhAjYzVO+DHl\/cccA996OaW5xxDz2LeX2D6cokCAwEAAQ== -----END PUBLIC KEY-----<\/code><\/pre>\n<p>\u0412\u0440\u044f\u0434 \u043b\u0438 \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0435\u0447\u0442\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432 base64 \u043c\u0435\u0436\u0434\u0443 \u0445\u0435\u0434\u0435\u0440\u043e\u043c \u0438 \u0444\u0443\u0442\u0435\u0440\u043e\u043c \u0432\u0438\u0434\u0430 <code>-----BEGIN [TYPE]-----<\/code> \u0438 <code>-----END [TYPE]-----<\/code> &#8212; \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c PEM \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440. \u041f\u043e \u0441\u0443\u0442\u0438, \u0442\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u0438\u0434\u0430, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u0435\u043d\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0432\u0441\u044f\u043a\u0438\u0435 \u043a\u0440\u0438\u043f\u0442\u043e-\u043d\u0438\u0448\u0442\u044f\u043a\u0438, \u0430 \u044d\u0442\u043e \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 DER \u0444\u043e\u0440\u043c\u0430\u0442\u0435.<\/p>\n<h3>1.2. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 DER<\/h3>\n<p>Distinguished Encoding Rules &#8212; \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f ASN.1 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0451\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0448 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 (\u043e\u043d \u0441\u0430\u043c\u044b\u0439 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439) \u0438\u0437 base64 \u0432 HEX<\/p>\n<pre><code>30 5c 30 0d 06 09 2a 86  48 86 f7 0d 01 01 01 05 00 03 4b 00 30 48 02 41  00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc  85 e4 f4 5f 27 4f 8e 3e 3c 13 b2 a0 1f 2b 7f 2c  ed 91 45 80 ff 38 40 8d 8c d5 3b e0 c7 97 f7 1c  70 0f 7d e8 e6 96 e7 1c 43 cf 62 de 5f 60 fa 72  89 02 03 01 00 01<\/code><\/pre>\n<p>DER \u0444\u043e\u0440\u043c\u0430\u0442 \u0438\u043c\u0435\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 TLV (Type, Length, Value). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Type &#8212; \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442, Length &#8212; \u043e\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0438 \u0432\u044b\u0448\u0435 (\u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0440\u0451\u0445 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b, \u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0434\u043e 128 \u0431\u0430\u0439\u0442), Value &#8212; &lt;Length> \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0431\u0430\u0439\u0442.<\/p>\n<p>\u0412\u0441\u0435 \u0442\u0438\u043f\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u043d\u043e \u043d\u0430\u0441 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">02<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">INTEGER<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0426\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">03<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">BIT STRING<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0438\u0442\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">04<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">OCTET STRING<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0431\u0430\u0439\u0442\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">05<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">NULL<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0443\u0441\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">06<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">OBJECT<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0431\u044a\u0435\u043a\u0442 \u0432 OID \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">0c<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">UTF8 STRING<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u043e\u043a\u0430 \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 UTF8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">30<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">SEQUENCE<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"59\" width=\"59\">\n<p align=\"left\">31<\/p>\n<\/td>\n<td data-colwidth=\"136\" width=\"136\">\n<p align=\"left\">SET<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0414\u043b\u0438\u043d\u0430 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443:<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043c\u0435\u0436\u0434\u0443 0 \u0438 127 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u043e \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0431\u0430\u0439\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0438\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 (\u0442\u043e \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 > 127), \u0442\u043e \u043c\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u044d\u0442\u0443 \u0435\u0434\u0438\u043d\u0438\u0446\u0443, \u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 &#8212; \u044d\u0442\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0431\u0430\u0439\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u044b, \u0432\u044b\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443. \u042f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <span>\u044d\u0442\u0438\u043c <\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/seccertenroll\/about-der-encoding-of-asn-1-types\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c<\/a>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u043a\u043b\u044e\u0447 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u0438\u0434\u0435:<\/p>\n<pre><code>30 5c (SEQUENSE - 92)   30 0d (SEQUENCE - 13)     06 09 (OBJECT - 9)       2a 86 48 86 f7 0d 01 01 01 (rsaEncryption)     05 00 (NULL - 0)   03 4b (BIT STRING - 75)     00 30 48 02 41 00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc ...<\/code><\/pre>\n<p>\u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0432\u0448\u0438\u0441\u044c, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 BIT STRING \u0432\u043f\u043e\u043b\u043d\u0435 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c:<\/p>\n<pre><code>30 48 (SEQUENCE - 72)   02 41 (INTEGER - 65),     00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f ... (\u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0431\u0430\u0437\u0435 10 \u043d\u0435 \u0431\u0443\u0434\u0443)   02 03 (INTEGER - 3),     01 00 01 (65537)<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u044e\u0447\u0435 modulus \u0438 exponent. \u0422\u0435 \u0441\u0430\u043c\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>openssl rsa -pubin -text<\/code>. \u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430:<\/p>\n<pre><code>30 82 01 3c (SEQUENCE - 316)   02 01 (INTEGER - 1)     00 (0)   02 41 (INTEGER - 65)     00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc 85 e4 f4 5f 27 4f 8e 3e 3c 13 b2 a0 1f 2b 7f 2c  ...   02 03 (INTEGER - 3)     01 00 01 (65537)   02 41 (INTEGER - 65)     00 8c 35 fb f9 7a 9a 63 6c 45 1a 42 fc 61 41 f6 88 b3 32 26 90 4c c1 cc 03 1a 04 55 99 21 bd 1e  ...   02 21 (INTEGER - 33)     00 e5 03 f0 ce 32 f9 2a 06 29 98 5d 67 67 86 0b ff 1f f6 0c bf d6 42 c9 3c 6d 58 f8 10 64 9c ff  ...   02 21 (INTEGER - 33)     00 c1 bd 8b 65 90 34 23 7f d1 7a 8b 82 56 37 0e a3 38 14 3a 4d dd b1 f2 14 ba 74 95 a5 3a 79 3a  ...   02 20 (INTEGER - 32)     1f 57 77 b8 30 7f ab 01 a6 e5 a4 3a c7 8f 2f cb 1d 8b a5 d9 07 30 a2 ab b3 67 4e a3 a7 b1 58 cf   02 21 (INTEGER - 33)     00 a0 17 09 fa d0 9f e4 bd 97 d1 55 3a 4c 17 8e a6 dc 8e 0a 67 91 4b 9b 27 f9 b2 a0 7d 39 c6 36  ...   02 21 (INTEGER - 33)     00 cc 09 26 b4 19 4f b2 4e 88 9d 4b 1e a4 26 05 a7 90 8b 24 9d b6 87 a9 f9 41 4b 69 df 20 dd 9d  ...<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043d\u0430\u0448\u0438 modulus \u0438 exponent, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u043a \u0440\u0430\u0437 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 public.key \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 (`openssl rsa -pubout`):<\/p>\n<pre><code>  02 41 (INTEGER - 65)     00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc 85 e4 f4 5f 27 4f 8e 3e 3c 13 b2 a0 1f 2b 7f 2c  ...   02 03 (INTEGER - 3)     01 00 01 (65537)<\/code><\/pre>\n<p>\u041f\u043b\u044e\u0441 \u043f\u0440\u043e\u0447\u0438\u0435 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435\u0441\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043e\u043d\u0438 \u0432\u043d\u043e\u0432\u044c \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0437\u0430 \u0441\u043a\u043e\u0443\u043f \u043c\u043e\u0435\u0433\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f. \u0421\u0435\u0439\u0447\u0430\u0441 \u0436\u0435, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0435\u043c\u0435 \u043c\u043e\u0438\u0445 \u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439:<\/p>\n<h3>1.3. \u0418\u0437 \u0447\u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u043d CSR<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e `openssl`:<\/p>\n<pre><code>openssl req -sha256 -new -key private.key -subj \"\/CN=asd\" > req.csr<\/code><\/pre>\n<pre><code>-----BEGIN CERTIFICATE REQUEST----- MIHHMHMCAQAwDjEMMAoGA1UEAwwDYXNkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJB AK1RiSg7+E2s2tyCtj\/63IXk9F8nT44+PBOyoB8rfyztkUWA\/zhAjYzVO+DHl\/cc cA996OaW5xxDz2LeX2D6cokCAwEAAaAAMA0GCSqGSIb3DQEBCwUAA0EAMKHzrPNG tceXiSuFt4laz0nFvt8psAcjhL\/Ke3Zf\/xDvLIum1Li7Q26qoRAqst90+Ux+I61w VqrwHTo2lEzU+Q== -----END CERTIFICATE REQUEST-----<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0435\u0433\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443<\/p>\n<pre><code>30 81 c7 (SEQUENCE - 199)   30 73 (SEQUENCE - 115)     02 01 (INTEGER - 1) \/\/ Version       00 (0)     30 0e (SEQUENCE - 14) \/\/ Subject       31 0c (SET - 12)         30 0a (SEQUENCE - 10)           06 03 (OBJECT - 3)             55 04 03 (commonName)           0c 03 (UTF8 - 3)             61 73 64 (asd)     30 5c (SEQUENCE - 92) \/\/ RSA Public Key       30 0d (SEQUENCE - 13)         06 09 (OBJECT - 9)           2a 86 48 86 f7 0d 01 01 01 (rsaEncryption)         05 00 (NULL - 0)       03 4b (BIT - 75)         00 30 48 02 41 00 ad 51 89 28 3b f8 4d ac da dc 82 b6 3f fa dc 85 e4 f4 5f 27 4f 8e 3e 3c 13 b2  ...     a0 00 (BER - 0) \/\/ Extended attribute list   30 0d (SEQUENCE - 13)     06 09 (OBJECT - 9) \/\/ Signature algorithm       2a 86 48 86 f7 0d 01 01 0b (sha256WithRSAEncryption)     05 00 (NULL - 0)   03 41 (BIT - 65) \/\/ Signature     00 30 a1 f3 ac f3 46 b5 c7 97 89 2b 85 b7 89 5a cf 49 c5 be df 29 b0 07 23 84 bf ca 7b 76 5f ff  ...<\/code><\/pre>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>Version &#8212; \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 0.<\/p>\n<\/li>\n<li>\n<p>Subject &#8212; \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0432\u0440\u043e\u0434\u0435 commonName, countryName \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043f\u043e\u043b\u044f \u043f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e CA.<\/p>\n<\/li>\n<li>\n<p>RSA Public Key &#8212; \u0442\u043e\u0447\u043d\u0430\u044f \u043a\u043e\u043f\u0438\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430<\/p>\n<\/li>\n<li>\n<p>Extended attribute list &#8212; \u0413\u0440\u0443\u043f\u043f\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 `Subject Alternative Names` (\u041d\u0435 \u0438\u0437\u0443\u0447\u0430\u043b, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0435\u0449\u0451)<\/p>\n<\/li>\n<li>\n<p>Signature algorithm &#8212; \u0421\u043e\u043e\u0431\u0449\u0430\u0435\u043c CA, \u043a\u0430\u043a\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441<\/p>\n<\/li>\n<li>\n<p>Signature &#8212; \u0441\u0430\u043c\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044c<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u043b\u0435\u0439 \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u0430: \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u0438 \u0438 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c CA. \u041d\u043e \u0432\u043e\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044c&#8230;<\/p>\n<h2>2. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c CSR<\/h2>\n<p>(\u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u0442\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0443\u043a\u0438, \u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0441\u0443\u0445\u0438\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f &#8212; \u0441\u043c\u0435\u043b\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0439\u0442\u0435 \u044d\u0442\u0443 \u0447\u0430\u0441\u0442\u044c)<\/p>\n<p>\u041f\u0440\u043e\u0432\u043e\u0437\u0438\u043b\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u043e\u043c \u044f \u043e\u043a\u043e\u043b\u043e \u043d\u0435\u0434\u0435\u043b\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0432\u0435\u0447\u0435\u0440\u043e\u0432 \u0432 \u043f\u043e\u043f\u044b\u0442\u043a\u0430\u0445 \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c, \u043b\u0438\u0431\u043e \u0441\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c. \u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e, \u0433\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a\u0443\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e, \u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u043e \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 CSR, \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b \u0432 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0447\u0430\u0442\u0430\u0445 \u043f\u043e \u0431\u044d\u043a\u0435\u043d\u0434\u0435\u0440\u0430\u043c &#8212; \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043d\u0438\u043a\u0442\u043e. \u041f\u043e\u0448\u0451\u043b \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430 StackOverflow, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0431\u0443\u044f \u0435\u0449\u0451 \u0440\u0430\u0437.<\/p>\n<p>\u0421\u0430\u043c \u0432\u043e\u043f\u0440\u043e\u0441 \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u043d\u043e, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u043e\u043b\u043e\u0436\u0443 \u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440, \u0430 \u0434\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u0436\u0443 \u043d\u0430 \u0440\u043e\u0434\u043d\u043e\u043c \u0440\u0443\u0441\u0441\u043a\u043e\u043c, \u043e\u043f\u0443\u0441\u0442\u0438\u0432 \u0432\u0441\u0451 \u0442\u043e, \u0447\u0442\u043e \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432\u044b\u0448\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0428\u0430\u0431\u043b\u043e\u043d \u043d\u0435\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 StackOverflow<\/summary>\n<div class=\"spoiler__content\">\n<p>I&#8217;m diving into cryptography algorithms with current task of getting certificates from <code>Let's Encrypt<\/code> by ACME protocol. At a step of generating Certificate Signing Request (CSR) I&#8217;ve encountered behaviour I can&#8217;t understand: how document signature is generated and why signature generated by me doesn&#8217;t match the one generated by <code>openssl req -new<\/code>.<\/p>\n<p>For my test I&#8217;ve generated key pair:<\/p>\n<pre><code>$ openssl genrsa 512 > private.key<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-346816","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=346816"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346816\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}