{"id":290654,"date":"2018-10-11T16:50:02","date_gmt":"2018-10-11T12:50:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=290654"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=290654","title":{"rendered":"\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435 PDF \u043d\u0430 JS \u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043d\u0430 C#, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u041a\u0440\u0438\u043f\u0442\u043e \u041f\u0420\u041e"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0418\u0442\u0430\u043a. \u041f\u0440\u0438\u0448\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c PDF \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e (\u0434\u0430\u043b\u0435\u0435 \u042d\u041f). \u0423 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u043e\u043a\u0435\u043d, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043d\u0430\u0434\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 PDF \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 back-end \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c ASP.NET \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e C#.<\/p>\n<p>  \u0412\u0441\u044f \u0441\u043e\u043b\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 CAdES-X Long Type 1, \u0438 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0435 \u0413\u041e\u0421\u0422 \u0420 34.10-2001, \u0413\u041e\u0421\u0422 \u0420 34.10-2012 \u0438 \u0442.\u043f. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c\u0438.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0448\u0438\u043b\u0438 \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u043d\u0430\u0441, \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442. \u041f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e hash \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430, \u043d\u043e \u043d\u0435 \u0441\u0430\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442.<\/p>\n<p>  \u0412 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u0431\u0443\u0434\u0443 \u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043c\u0430\u043b\u043e\u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0442\u0435\u043c\u044b \u043c\u043e\u043c\u0435\u043d\u0442\u044b, \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u041a\u043e\u0434 \u043d\u0430 JS \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432, JS-\u0434\u0432\u0438\u0436\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 Promise \u0438 function generator. \u0414\u0443\u043c\u0430\u044e \u043a\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f IE \u043d\u0430\u043f\u0438\u0448\u0443\u0442 \u0441\u0430\u043c\u0438 (\u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u00ab\u0447\u0435\u0440\u0435\u0437 \u043d\u0435 \u0445\u043e\u0447\u0443\u00bb).<\/p>\n<p>  \u0427\u0442\u043e \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ol>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442.<\/li>\n<li>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c plug-in \u043e\u0442 \u041a\u0440\u0438\u043f\u0442\u043e \u041f\u0420\u041e. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 JS \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043a\u0440\u0438\u043f\u0442\u043e\u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u043c.<\/li>\n<\/ol>\n<p>  \u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u0426\u0421 \u041a\u0440\u0438\u043f\u0442\u043e \u041f\u0420\u041e \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432 (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 ~1500\u0440 \u0441 \u0433\u043e\u0434\u043e\u0432\u043e\u0439 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0435\u0439 \u043d\u0430 \u041a\u0440\u0438\u043f\u0442\u043e \u041f\u0420\u041e \u0438 \u0434\u0432\u0443\u043c\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430\u043c\u0438: \u043d\u043e \u00ab\u043d\u043e\u0432\u043e\u043c\u0443\u00bb \u0438 \u00ab\u0441\u0442\u0430\u0440\u043e\u043c\u0443\u00bb \u0413\u041e\u0421\u0422)<\/li>\n<li>\u0413\u043e\u0432\u043e\u0440\u044f\u0442, plug-in \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0441 ViPNet, \u043d\u043e \u044f \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b.<\/li>\n<\/ol>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f PDF.<br \/>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u0442 \u041a\u0440\u0438\u043f\u0442\u043e \u041f\u0420\u041e:<\/p>\n<pre><code class=\"xml\">&lt;script src=&quot;\/Scripts\/cadesplugin_api.js&quot; type=&quot;text\/javascript&quot;&gt;&lt;\/script&gt; <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d \u043e\u0431\u044a\u0435\u043a\u0442 cadesplugin<\/p>\n<pre><code class=\"javascript\">window.cadespluginLoaded = false; cadesplugin.then(function () {     window.cadespluginLoaded = true; }); <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 hash. \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u0435\u0449\u0451 \u043d\u0430\u0434\u043e \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c. \u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0440\u0435\u043c\u0430\u0440\u043a\u0430: \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u00ab\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435\u00bb \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0435\u0439 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b \u0432 \u043e\u0431\u044a\u0435\u043a\u0442 CryptographyObject.<\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f certificates \u043e\u0431\u044a\u0435\u043a\u0442\u0430 CryptographyObject:<\/p>\n<pre><code class=\"javascript\">    fillCertificates: function (failCallback) {              cadesplugin.async_spawn(function*() {                 try {                     let oStore = yield cadesplugin.CreateObjectAsync(&quot;CAPICOM.Store&quot;);                      oStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE,                         cadesplugin.CAPICOM_MY_STORE,                         cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED);                      let certs = yield oStore.Certificates;                     certs = yield certs.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);                     let certsCount = yield certs.Count;                     for (let i = 1; i &lt;= certsCount; i++) {                         let cert = yield certs.Item(i);                         CryptographyObject.certificates.push(cert);                     }                     oStore.Close();                 } catch (exc) {                      failCallback(exc);                 }             });     } <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439: \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432\u044b\u0434\u0430\u0441\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0430\u0439\u0442 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430\u043c\u0438, \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0435\u0439 \u0438 \u043f\u0440\u043e\u0447\u0435\u0439 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u0435\u0440\u0443\u043d\u0434\u043e\u0439. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0442\u0443\u0442 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab\u0414\u0430\u00bb<br \/>  \u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b, \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u043d\u0435 \u043f\u0440\u043e\u0441\u0440\u043e\u0447\u0435\u043d\u043d\u044b\u0435) \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 certificates. \u042d\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437-\u0437\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0434\u044b cadesplugin (\u0434\u043b\u044f IE \u0432\u0441\u0451 \u0438\u043d\u0430\u0447\u0435 \ud83d\ude09 ).<\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f hash:<\/p>\n<pre><code class=\"javascript\">getHash: function (certIndex, successCallback, failCallback, \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0435\u0449\u0451 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b) {         try {             cadesplugin.async_spawn(function*() {                 let cert = CryptographyObject.certificates[certIndex];                 let certPublicKey = yield cert.PublicKey();                 let certAlgorithm = yield certPublicKey.Algorithm;                 let certAlgorithmFriendlyName = yield certAlgorithm.FriendlyName;                 let hashAlgorithm;                 \/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043e \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u0437 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f                 if (certAlgorithmFriendlyName.match(\/2012 512\/i))                     hashAlgorithm = &quot;2012512&quot;;                 else if (certAlgorithmFriendlyName.match(\/2012 256\/i))                     hashAlgorithm = &quot;2012256&quot;;                 else if (certAlgorithmFriendlyName.match(\/2001\/i))                     hashAlgorithm = &quot;3411&quot;;                 else {                     failCallback();                     return;                 }                  $.ajax({                     url: &quot;\/Services\/SignService.asmx\/GetHash&quot;,                     method: &quot;POST&quot;,                     contentType: &quot;application\/json; charset=utf-8 &quot;,                     dataType: &quot;json&quot;,                     data: JSON.stringify({                         \/\/\u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430                         \/\/\u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438\u043c\u0435\u0435\u0442 \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430                         hashAlgorithm: hashAlgorithm,                     }),                     complete: function (response) {                         \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440                         if (response.status === 200) {                             CryptographyObject.signHash(response.responseJSON,                                 function(data) {                                     $.ajax({                                         url: CryptographyObject.signServiceUrl,                                         method: &quot;POST&quot;,                                         contentType: &quot;application\/json; charset=utf-8&quot;,                                         dataType: &quot;json&quot;,                                         data: JSON.stringify({                                             Signature: data.Signature,                                             \/\/\u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430                                             \/\/\u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e                                         }),                                         complete: function(response) {                                             if (response.status === 200)                                                 successCallback();                                             else                                                 failCallback();                                         }                                     });                                 },                                 certIndex);                         } else {                             failCallback();                         }                     }                 });             });         } catch (exc) {             failCallback(exc);         }     } <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439: \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 cadesplugin.async_spawn, \u0432 \u043d\u0435\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f next(), \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0443 \u043a yield.<br \/>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 async-await \u0438\u0437 C#. \u0412\u0441\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043b\u0438 hash.<\/p>\n<p>  \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c nuget-\u043f\u0430\u043a\u0435\u0442 iTextSharp (\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f 5.5.13)<\/p>\n<p>  \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u0435\u043d CryptoPro.Sharpei, \u043e\u043d \u0438\u0434\u0451\u0442 \u0432 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043a \u041a\u0440\u0438\u043f\u0442\u043e \u041f\u0420\u041e .NET SDK<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c hash<\/p>\n<pre><code class=\"cs\">                \/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c hash-\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c                 HashAlgorithm hashAlgorithm;                  switch (hashAlgorithmName)                 {                     case &quot;3411&quot;:                         hashAlgorithm = new Gost3411CryptoServiceProvider();                         break;                     case &quot;2012256&quot;:                         hashAlgorithm = new Gost3411_2012_256CryptoServiceProvider();                         break;                     case &quot;2012512&quot;:                         hashAlgorithm = new Gost3411_2012_512CryptoServiceProvider();                         break;                     default:                         GetLogger().AddError(&quot;\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f&quot;, $&quot;hashAlgorithmName: {hashAlgorithmName}&quot;);                         return HttpStatusCode.BadRequest;                 }                 \/\/\u043f\u043e\u043b\u0443\u0447\u0438\u043c hash \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u043c cadesplugin                 string hash;                 using (hashAlgorithm)                 \/\/downloadResponse.RawBytes - \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e PDF \u0444\u0430\u0439\u043b\u0430                 using (PdfReader reader = new PdfReader(downloadResponse.RawBytes))                 {                     \/\/\u0438\u0449\u0435\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0438                     int existingSignaturesNumber = reader.AcroFields.GetSignatureNames().Count;                     using (MemoryStream stream = new MemoryStream())                     {                         \/\/\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438                         using (PdfStamper st = PdfStamper.CreateSignature(reader, stream, '\\0', null, true))                         {                             PdfSignatureAppearance appearance = st.SignatureAppearance;                             \/\/\u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0430\u0434\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439, \u0447\u0442\u043e\u0431 \u043e\u043d\u0438 \u043d\u0435 \u043d\u0430\u043b\u043e\u0436\u0438\u043b\u0438\u0441\u044c \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430                             appearance.SetVisibleSignature(new Rectangle(36, 100, 164, 150), reader.NumberOfPages,                                 \/\/\u0437\u0430\u0434\u0430\u0451\u043c \u0438\u043c\u044f \u043f\u043e\u043b\u044f, \u043e\u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438                                 $&quot;{SignatureFieldNamePrefix}{existingSignaturesNumber + 1}&quot;);                             \/\/\u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043f\u0440\u0438\u0434\u0451\u0442 \u0438\u0437\u0432\u043d\u0435                             ExternalBlankSignatureContainer external =                                 new ExternalBlankSignatureContainer(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_DETACHED);                             \/\/\u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 - \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u0442\u0430 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445 \u043c\u044b \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u0434 \u043f\u043e\u0434\u043f\u0438\u0441\u044c                             \/\/\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u044e \u043c\u043d\u043e\u0433\u043e, \u0442.\u043a. CAdES-X Long Type 1 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0434\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u0446\u0435\u043d\u0442\u0440\u0430                             MakeSignature.SignExternalContainer(appearance, external, 65536);                             \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0442\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c                             using (Stream contentStream = appearance.GetRangeStream())                             {                                 \/\/\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c hash \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0435\u0433\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0443, \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e cadesplugin                                 hash = string.Join(string.Empty,                                     hashAlgorithm.ComputeHash(contentStream).Select(x =&gt; x.ToString(&quot;X2&quot;)));                             }                         }                         \/\/\u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c stream \u043a\u0443\u0434\u0430 \u0445\u043e\u0442\u0438\u043c, \u043e\u043d \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0431\u044b \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044c                     }                 } <\/code><\/pre>\n<p>  \u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 hash \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e<\/p>\n<pre><code class=\"javascript\">    \/\/certIndex - \u0438\u043d\u0434\u0435\u043a\u0441 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438 hash \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435     signHash: function (data, callback, certIndex, failCallback) {         try {             cadesplugin.async_spawn(function*() {                 certIndex = certIndex | 0;                  let oSigner = yield cadesplugin.CreateObjectAsync(&quot;CAdESCOM.CPSigner&quot;);                  let cert = CryptographyObject.certificates[certIndex];                  oSigner.propset_Certificate(cert);                 oSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN);                 \/\/\u0442\u0443\u0442 \u043d\u0430\u0434\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 TSP \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u042d\u0442\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043e\u0442 \u041a\u0440\u0438\u043f\u0442\u043e \u041f\u0420\u041e                 oSigner.propset_TSAAddress(&quot;https:\/\/www.cryptopro.ru\/tsp\/&quot;);                  let hashObject = yield cadesplugin.CreateObjectAsync(&quot;CAdESCOM.HashedData&quot;);                  let certPublicKey = yield cert.PublicKey();                 let certAlgorithm = yield certPublicKey.Algorithm;                 let certAlgorithmFriendlyName = yield certAlgorithm.FriendlyName;                  if (certAlgorithmFriendlyName.match(\/2012 512\/i)) {                     yield hashObject.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512);                 } else if (certAlgorithmFriendlyName.match(\/2012 256\/i)) {                     yield hashObject.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256);                 } else if (certAlgorithmFriendlyName.match(\/2001\/i)) {                     yield hashObject.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411);                 } else {                     alert(&quot;\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u044d\u0442\u0438\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c&quot;);                     return;                 }                 \/\/\u0432 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f hash \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 hash \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430                 yield hashObject.SetHashValue(data.Hash);                  let oSignedData = yield cadesplugin.CreateObjectAsync(&quot;CAdESCOM.CadesSignedData&quot;);                 oSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY);                 \/\/\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432 base64                 let signatureHex =                     yield oSignedData.SignHash(hashObject, oSigner, cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1);                  data.Signature = signatureHex;                 callback(data);             });         } catch (exc) {             failCallback(exc);         }     } <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439: \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 (\u0441\u043c. \u0432\u044b\u0448\u0435)<\/p>\n<p>  \u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/p>\n<pre><code class=\"cs\"> \/\/\u0432\u0441\u044f\u043a\u0438\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438                 \/\/downloadResponse.RawBytes - \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 PDF \u0441 \u043f\u0443\u0441\u0442\u044b\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438                 using (PdfReader reader = new PdfReader(downloadResponse.RawBytes))                 {                     using (MemoryStream stream = new MemoryStream())                     {                         \/\/requestData.Signature - \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430                         IExternalSignatureContainer external = new SimpleExternalSignatureContainer(Convert.FromBase64String(requestData.Signature));                     \/\/lastSignatureName - \u0438\u043c\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u043f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 hash                         MakeSignature.SignDeferred(reader, lastSignatureName, stream, external);                                              \/\/\u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b                     }                 } <\/code><\/pre>\n<p>  \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439: SimpleExternalSignatureContainer \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IExternalSignatureContainer<\/p>\n<pre><code class=\"cs\">        \/\/\/ &lt;summary&gt;         \/\/\/ \u041f\u0440\u043e\u0441\u0442\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438         \/\/\/ &lt;\/summary&gt;         private class SimpleExternalSignatureContainer : IExternalSignatureContainer         {             private readonly byte[] _signedBytes;              public SimpleExternalSignatureContainer(byte[] signedBytes)             {                 _signedBytes = signedBytes;             }              public byte[] Sign(Stream data)             {                 return _signedBytes;             }              public void ModifySigningDictionary(PdfDictionary signDic)             {              }         } <\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c PDF \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442\u2026<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/www.cryptopro.ru\/sites\/default\/files\/products\/cades\/demopage\/cades_xlong_sample.html\">www.cryptopro.ru\/sites\/default\/files\/products\/cades\/demopage\/cades_xlong_sample.html<\/a><br \/>  <a href=\"http:\/\/cpdn.cryptopro.ru\/content\/cades\/plugin-activation.html\">cpdn.cryptopro.ru\/content\/cades\/plugin-activation.html<\/a><br \/>  <a href=\"https:\/\/www.cryptopro.ru\/forum2\/default.aspx?g=posts&#038;t=11119\">www.cryptopro.ru\/forum2\/default.aspx?g=posts&#038;t=11119<\/a><br \/>  <a href=\"https:\/\/www.cryptopro.ru\/forum2\/default.aspx?g=posts&#038;t=3691&#038;p=21\">www.cryptopro.ru\/forum2\/default.aspx?g=posts&#038;t=3691&#038;p=21<\/a><br \/>  <a href=\"http:\/\/cpdn.cryptopro.ru\/default.asp?url=content\/cades\/plugin-samples-raw-signature.html\">cpdn.cryptopro.ru\/default.asp?url=content\/cades\/plugin-samples-raw-signature.html<\/a><br \/>  <a href=\"http:\/\/cpdn.cryptopro.ru\/default.asp?url=content\/cades\/plugin.html\">cpdn.cryptopro.ru\/default.asp?url=content\/cades\/plugin.html<\/a><br \/>  <a href=\"http:\/\/itextsupport.com\/apidocs\/itext5\/5.5.9\/com\/itextpdf\/text\/pdf\/PdfStamper.html#createSignature-com.itextpdf.text.pdf.PdfReader-java.io.OutputStream-char-java.io.File-boolean-\">itextsupport.com\/apidocs\/itext5\/5.5.9\/com\/itextpdf\/text\/pdf\/PdfStamper.html#createSignature-com.itextpdf.text.pdf.PdfReader-java.io.OutputStream-char-java.io.File-boolean-<\/a>  <\/div>\n<\/div>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/426087\/\"> https:\/\/habr.com\/post\/426087\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0418\u0442\u0430\u043a. \u041f\u0440\u0438\u0448\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c PDF \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e (\u0434\u0430\u043b\u0435\u0435 \u042d\u041f). \u0423 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u043e\u043a\u0435\u043d, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447. \u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043d\u0430\u0434\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 PDF \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 back-end \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c ASP.NET \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e C#.<\/p>\n<p>  \u0412\u0441\u044f \u0441\u043e\u043b\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 CAdES-X Long Type 1, \u0438 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0435 \u0413\u041e\u0421\u0422 \u0420 34.10-2001, \u0413\u041e\u0421\u0422 \u0420 34.10-2012 \u0438 \u0442.\u043f. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0435\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c\u0438.  <\/p>\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-290654","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290654","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=290654"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290654\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=290654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=290654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=290654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}