{"id":359018,"date":"2024-05-21T00:23:47","date_gmt":"2024-05-21T00:23:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=359018"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=359018","title":{"rendered":"<span>.NET 7 \u043f\u0440\u043e\u0442\u0438\u0432 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u043e\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438. \u0427\u0430\u0441\u0442\u044c 2. \u0428\u0442\u0430\u043c\u043f\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/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>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 .NET 7. \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 <a href=\"https:\/\/habr.com\/ru\/articles\/734368\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u0442\u0430\u043b\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0442\u0430\u043c\u043f\u043e\u0432 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (TS) \u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044c. \u0421 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. \u0421\u043e \u0448\u0442\u0430\u043c\u043f\u0430\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 .NET 7 \u0442\u0430 \u0436\u0435 \u0431\u0435\u0434\u0430, \u0447\u0442\u043e \u0438 \u0441 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 &#8212; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u041d\u043e, \u0431\u043b\u0430\u0433\u043e, \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 WinAPI \u0438 \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<p>\u0421\u0430\u043c\u0443 \u0442\u0435\u043e\u0440\u0438\u044e TS \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0437\u0430 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u044e \u0432 <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc3161\" rel=\"noopener noreferrer nofollow\">RFC3161<\/a>, \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0435 \u0432\u044b\u043a\u0440\u0443\u0442\u0430\u0441\u044b \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u044b <a href=\"https:\/\/habr.com\/ru\/companies\/croc\/articles\/534820\" rel=\"noopener noreferrer nofollow\">\u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0448\u0442\u0430\u043c\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/h3>\n<p>\u0412 WinAPI \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0448\u0442\u0430\u043c\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptretrievetimestamp\" rel=\"noopener noreferrer nofollow\"><code>CryptRetrieveTimeStamp<\/code><\/a>.<\/p>\n<p>\u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary> \/\/\/ Calculates a timestamp token for a given data \/\/\/ &lt;\/summary> \/\/\/ &lt;param name=\"data\">A source binary data for timestamping&lt;\/param> \/\/\/ &lt;param name=\"tspDigestOid\">An OID of a message digest algorithm&lt;\/param> \/\/\/ &lt;param name=\"nonce\">A nonce value, can be empty&lt;\/param> \/\/\/ &lt;param name=\"tsaUri\">An URI of a TSA&lt;\/param> \/\/\/ &lt;param name=\"timeout\">A TSA request timeout&lt;\/param> \/\/\/ &lt;returns>A timestamp token in DER encoding&lt;\/returns> public static unsafe byte[] RetriveTimestamp(ReadOnlySpan&lt;byte> data, Oid tspDigestOid, ReadOnlySpan&lt;byte> nonce, string tsaUri, TimeSpan timeout) { var tspReq = new CRYPT_TIMESTAMP_PARA(); tspReq.fRequestCerts = true; fixed (byte* pData = data, pNonce = nonce) { if (nonce.Length > 0) { tspReq.Nonce.cbData = (uint)nonce.Length; tspReq.Nonce.pbData = (nint)pNonce; }  nint pTsContext; CryptRetrieveTimeStamp(tsaUri, TIMESTAMP_NO_AUTH_RETRIEVAL | TIMESTAMP_VERIFY_CONTEXT_SIGNATURE,  timeout.Milliseconds, tspDigestOid.Value, (nint)(&amp;tspReq), (nint)pData, (uint)data.Length, (nint)(&amp;pTsContext), 0, 0).VerifyWinapiTrue(); try { var tsContext = new ReadOnlySpan&lt;CRYPT_TIMESTAMP_CONTEXT>(pTsContext.ToPointer(), 1); var tst = new ReadOnlySpan&lt;byte>(tsContext[0].pbEncoded.ToPointer(), (int)tsContext[0].cbEncoded); return tst.ToArray(); } finally { if (pTsContext != 0) CryptMemFree(pTsContext); } } } <\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f: <\/p>\n<ol>\n<li>\n<p><code>data<\/code> &#8212; \u0434\u0430\u043d\u043d\u044b\u0435, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/li>\n<li>\n<p><code>tspDigestOid<\/code> &#8212; OID \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u0432 TSA \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435 \u0441\u0430\u043c\u0438 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0438\u0445 \u0445\u044d\u0448, \u0442\u043e \u044d\u0442\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438, \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><code>nonce<\/code> &#8212; \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0431\u0430\u0439\u0442\u043e\u0432, \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0430\u0442\u0430\u043a \u043f\u043e\u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439, \u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u042f \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e 16 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0431\u0430\u0439\u0442.<\/p>\n<\/li>\n<li>\n<p><code>tsaUri<\/code> &#8212; URI \u0446\u0435\u043d\u0442\u0440\u0430 \u0432\u044b\u0434\u0430\u0447\u0438 \u0448\u0442\u0430\u043c\u043f\u043e\u0432 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (TSA).<\/p>\n<\/li>\n<li>\n<p><code>timeout<\/code> &#8212; \u0442\u0430\u0439\u043c\u0430\u0443\u0442 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 TSA.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/ns-wincrypt-crypt_timestamp_para\" rel=\"noopener noreferrer nofollow\"><code>CRYPT_TIMESTAMP_PARA<\/code><\/a> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 TS. \u0418\u0437 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430: <code>Nonce<\/code> \u0438 <code>fRequestCerts<\/code>. \u0412 \u043f\u0435\u0440\u0432\u043e\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043d\u0430\u0448 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>nonce<\/code>, \u0432\u0442\u043e\u0440\u043e\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0432 <code>true<\/code> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b TSA \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u0432 \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u0448\u0442\u0430\u043c\u043f\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptretrievetimestamp\" rel=\"noopener noreferrer nofollow\"><code>CryptRetrieveTimeStamp<\/code><\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430 \u043d\u0430\u0441 \u0432\u0441\u044e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443: \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0445\u044d\u0448 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a TSA, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u043e HTTP, \u0447\u0438\u0442\u0430\u0435\u0442 \u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 TSA, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 TSA (\u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u043d \u0444\u043b\u0430\u0433 <code>TIMESTAMP_VERIFY_CONTEXT_SIGNATURE<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u0430 TSA (\u043f\u043e\u043b\u0435 <code>pbEncoded<\/code> \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/ns-wincrypt-crypt_timestamp_context\" rel=\"noopener noreferrer nofollow\"><code>CRYPT_TIMESTAMP_CONTEXT<\/code><\/a>).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438 c \u043e\u0442\u0432\u0435\u0442\u043e\u043c TSA \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmemfree\" rel=\"noopener noreferrer nofollow\"><code>CryptMemFree<\/code><\/a>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u043e\u043a\u0435\u043d, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0432 \u043f. 4, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b, \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044f \u0435\u0433\u043e \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043a \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e. \u041f\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u042d\u0422\u0420\u0410\u041d \u041e\u0410\u041e &#171;\u0420\u0416\u0414&#187;, \u0433\u0434\u0435 \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 CMS.<\/p>\n<h3>\u0412\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0448\u0442\u0430\u043c\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &#8212; \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043d\u0435\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u0422\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc5126#section-4.4.1\" rel=\"noopener noreferrer nofollow\"><code>CAdES-T<\/code><\/a> \u0438 \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445. WinAPI \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0438 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443, \u043f\u0440\u0430\u0432\u0434\u0430 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418 \u0432\u043d\u043e\u0432\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043e\u0434\u0438\u043d \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary> \/\/\/ Calculates and adds a timestamp token to a CMS message as an unsigned attribute \/\/\/ &lt;\/summary> \/\/\/ &lt;param name=\"cms\">A target CMS message&lt;\/param> \/\/\/ &lt;param name=\"detachedSignature\">A flag of the detached signature in the CMS&lt;\/param> \/\/\/ &lt;param name=\"signerIndex\">An index of the CMS signer&lt;\/param> \/\/\/ &lt;param name=\"tspDigestOid\">An OID of a message digest algorithm&lt;\/param> \/\/\/ &lt;param name=\"nonce\">A nonce value, can be empty&lt;\/param> \/\/\/ &lt;param name=\"tsaUri\">An URI of a TSA&lt;\/param> \/\/\/ &lt;param name=\"timeout\">A TSA request timeout&lt;\/param> \/\/\/ &lt;returns>A new CMS message with an injected timestamp token&lt;\/returns> public static unsafe byte[] AddTimestampToCms(ReadOnlySpan&lt;byte> cms, bool detachedSignature, uint signerIndex, Oid tspDigestOid, ReadOnlySpan&lt;byte> nonce, string tsaUri, TimeSpan timeout) { var hMsg = CryptMsgOpenToDecode(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, detachedSignature ? CMSG_DETACHED_FLAG : 0U, 0, 0, 0, 0) .VerifyWinapiNonzero(); try { \/\/ load the CMS signed message fixed (byte* pCms = cms) CryptMsgUpdate(hMsg, (nint)pCms, (uint)cms.Length, true).VerifyWinapiTrue();  \/\/ extract the signature from the CMS message for the specified signerIndex var signatureLength = 0; CryptMsgGetParam(hMsg, CMSG_ENCRYPTED_DIGEST, signerIndex, 0, (nint)(&amp;signatureLength)).VerifyWinapiTrue(); var signature = stackalloc byte[signatureLength]; CryptMsgGetParam(hMsg, CMSG_ENCRYPTED_DIGEST, signerIndex, (nint)signature, (nint)(&amp;signatureLength)).VerifyWinapiTrue();  \/\/ receive timestamp on the extracted signature var tst = RetriveTimestamp(new ReadOnlySpan&lt;byte>(signature, signatureLength), tspDigestOid, nonce, tsaUri, timeout);  \/\/ add a new unsigned attribute fixed (byte* pzdObjId = \"1.2.840.113549.1.9.16.2.14\"u8, pTst = tst) { var tstBlob = new CRYPT_INTEGER_BLOB(); tstBlob.cbData = (uint)tst.Length; tstBlob.pbData = (nint)pTst;  var tstAttr = new CRYPT_ATTRIBUTE(); tstAttr.pszObjId = (nint)pzdObjId; tstAttr.cValue = 1; tstAttr.rgValue = (nint)(&amp;tstBlob);  \/\/ encode a timestamp attribute to DER var attr = (nint)0; var attrLen = 0U; CryptEncodeObjectEx(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, PKCS_ATTRIBUTE, (nint)(&amp;tstAttr), CRYPT_ENCODE_ALLOC_FLAG, 0, (nint)(&amp;attr), (nint)(&amp;attrLen)).VerifyWinapiTrue(); try { \/\/ inject the encoded unsigned attribute to the SignerInfo var cmsAttr = new CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA(); cmsAttr.dwSignerIndex = signerIndex; cmsAttr.blob.cbData = attrLen; cmsAttr.blob.pbData = attr; CryptMsgControl(hMsg, 0, CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR, (nint)(&amp;cmsAttr)).VerifyWinapiTrue(); } finally { LocalFree(attr).VerifyWinapiZero(); } }  \/\/ extract the updated CMS message uint updatedCmsLength = 0; CryptMsgGetParam(hMsg, CMSG_ENCODED_MESSAGE, 0, 0, (nint)(&amp;updatedCmsLength)).VerifyWinapiTrue(); var updatedCms = new byte[updatedCmsLength]; fixed (byte* pUpdatedCms = updatedCms) CryptMsgGetParam(hMsg, CMSG_ENCODED_MESSAGE, 0, (nint)pUpdatedCms, (nint)(&amp;updatedCmsLength)).VerifyWinapiTrue(); return updatedCms; } finally { CryptMsgClose(hMsg); } } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0437\u043e\u0432\u043e\u043c <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsgopentodecode\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgOpenToDecode<\/code><\/a> \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0443\u0441\u0442\u043e\u0435 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u044f <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsgupdate\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgUpdate<\/code><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u0430\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>signerIndex<\/code> (\u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u043e\u0432, \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e): <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsggetparam\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgGetParam(hMsg, CMSG_ENCRYPTED_DIGEST, ...)<\/code><\/a>. \u0418\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>RetriveTimestamp<\/code> \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptencodeobjectex\" rel=\"noopener noreferrer nofollow\"><code>CryptEncodeObjectEx<\/code><\/a> \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 CMS-\u0430\u0442\u0440\u0438\u0431\u0443\u0442 <a href=\"https:\/\/oidref.com\/1.2.840.113549.1.9.16.2.14\" rel=\"noopener noreferrer nofollow\"><code>id-aa-timeStampToken<\/code><\/a> c OID=1.2.840.113549.1.9.16.2.14. \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/ns-wincrypt-cmsg_ctrl_add_signer_unauth_attr_para\" rel=\"noopener noreferrer nofollow\"><code>CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA<\/code><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u043e\u0432\u043e\u043c <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsgcontrol\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgControl(..., CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR, ...)<\/code><\/a> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>signerIndex<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u043b\u044e\u0431\u0435\u0437\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043d\u0430 \u0448\u0430\u0433\u0435 5, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0443\u044e <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/winbase\/nf-winbase-localfree\" rel=\"noopener noreferrer nofollow\"><code>LocalFree<\/code><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u043e\u0435 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u044b\u0432\u043e\u0432 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsggetparam\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgGetParam(hMsg, CMSG_ENCODED_MESSAGE, ...)<\/code><\/a> \u0432 \u0432\u0438\u0434\u0435 \u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0432\u044b\u0437\u044b\u0432\u0430\u044f <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsgclose\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgClose<\/code><\/a>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0442\u0430\u043c, \u0433\u0434\u0435 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041f\u043e\u043b\u044c\u0437\u0443\u044f\u0441\u044c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441 WinAPI, \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0431\u043e\u0448\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 .NET 7 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043a\u0440\u0438\u043f\u0442\u043e\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041d\u043e, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434 Windows. \u041f\u043e\u0434 Linux, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u044b\u0437\u043e\u0432\u044b \u043a OpenSSL; \u043d\u043e \u044d\u0442\u043e, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b P\/Invoke \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/AntoineLarine\/NetWinapiCms\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/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\/articles\/771162\/\"> https:\/\/habr.com\/ru\/articles\/771162\/<\/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>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 .NET 7. \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 <a href=\"https:\/\/habr.com\/ru\/articles\/734368\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u0442\u0430\u043b\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0442\u0430\u043c\u043f\u043e\u0432 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (TS) \u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u044c. \u0421 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430. \u0421\u043e \u0448\u0442\u0430\u043c\u043f\u0430\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 .NET 7 \u0442\u0430 \u0436\u0435 \u0431\u0435\u0434\u0430, \u0447\u0442\u043e \u0438 \u0441 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 &#8212; \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u041d\u043e, \u0431\u043b\u0430\u0433\u043e, \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 WinAPI \u0438 \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<p>\u0421\u0430\u043c\u0443 \u0442\u0435\u043e\u0440\u0438\u044e TS \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0437\u0430 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u044e \u0432 <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc3161\" rel=\"noopener noreferrer nofollow\">RFC3161<\/a>, \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0435 \u0432\u044b\u043a\u0440\u0443\u0442\u0430\u0441\u044b \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u044b <a href=\"https:\/\/habr.com\/ru\/companies\/croc\/articles\/534820\" rel=\"noopener noreferrer nofollow\">\u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0448\u0442\u0430\u043c\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/h3>\n<p>\u0412 WinAPI \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0448\u0442\u0430\u043c\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptretrievetimestamp\" rel=\"noopener noreferrer nofollow\"><code>CryptRetrieveTimeStamp<\/code><\/a>.<\/p>\n<p>\u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary> \/\/\/ Calculates a timestamp token for a given data \/\/\/ &lt;\/summary> \/\/\/ &lt;param name=\"data\">A source binary data for timestamping&lt;\/param> \/\/\/ &lt;param name=\"tspDigestOid\">An OID of a message digest algorithm&lt;\/param> \/\/\/ &lt;param name=\"nonce\">A nonce value, can be empty&lt;\/param> \/\/\/ &lt;param name=\"tsaUri\">An URI of a TSA&lt;\/param> \/\/\/ &lt;param name=\"timeout\">A TSA request timeout&lt;\/param> \/\/\/ &lt;returns>A timestamp token in DER encoding&lt;\/returns> public static unsafe byte[] RetriveTimestamp(ReadOnlySpan&lt;byte> data, Oid tspDigestOid, ReadOnlySpan&lt;byte> nonce, string tsaUri, TimeSpan timeout) { var tspReq = new CRYPT_TIMESTAMP_PARA(); tspReq.fRequestCerts = true; fixed (byte* pData = data, pNonce = nonce) { if (nonce.Length > 0) { tspReq.Nonce.cbData = (uint)nonce.Length; tspReq.Nonce.pbData = (nint)pNonce; }  nint pTsContext; CryptRetrieveTimeStamp(tsaUri, TIMESTAMP_NO_AUTH_RETRIEVAL | TIMESTAMP_VERIFY_CONTEXT_SIGNATURE,  timeout.Milliseconds, tspDigestOid.Value, (nint)(&amp;tspReq), (nint)pData, (uint)data.Length, (nint)(&amp;pTsContext), 0, 0).VerifyWinapiTrue(); try { var tsContext = new ReadOnlySpan&lt;CRYPT_TIMESTAMP_CONTEXT>(pTsContext.ToPointer(), 1); var tst = new ReadOnlySpan&lt;byte>(tsContext[0].pbEncoded.ToPointer(), (int)tsContext[0].cbEncoded); return tst.ToArray(); } finally { if (pTsContext != 0) CryptMemFree(pTsContext); } } } <\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f: <\/p>\n<ol>\n<li>\n<p><code>data<\/code> &#8212; \u0434\u0430\u043d\u043d\u044b\u0435, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/li>\n<li>\n<p><code>tspDigestOid<\/code> &#8212; OID \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u0432 TSA \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0435 \u0441\u0430\u043c\u0438 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u0438\u0445 \u0445\u044d\u0448, \u0442\u043e \u044d\u0442\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0445\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438, \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u0435\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><code>nonce<\/code> &#8212; \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0431\u0430\u0439\u0442\u043e\u0432, \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 \u0430\u0442\u0430\u043a \u043f\u043e\u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439, \u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u042f \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e 16 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0431\u0430\u0439\u0442.<\/p>\n<\/li>\n<li>\n<p><code>tsaUri<\/code> &#8212; URI \u0446\u0435\u043d\u0442\u0440\u0430 \u0432\u044b\u0434\u0430\u0447\u0438 \u0448\u0442\u0430\u043c\u043f\u043e\u0432 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (TSA).<\/p>\n<\/li>\n<li>\n<p><code>timeout<\/code> &#8212; \u0442\u0430\u0439\u043c\u0430\u0443\u0442 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 TSA.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/ns-wincrypt-crypt_timestamp_para\" rel=\"noopener noreferrer nofollow\"><code>CRYPT_TIMESTAMP_PARA<\/code><\/a> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 TS. \u0418\u0437 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430: <code>Nonce<\/code> \u0438 <code>fRequestCerts<\/code>. \u0412 \u043f\u0435\u0440\u0432\u043e\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043d\u0430\u0448 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>nonce<\/code>, \u0432\u0442\u043e\u0440\u043e\u0435 \u0441\u0442\u0430\u0432\u0438\u043c \u0432 <code>true<\/code> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b TSA \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u0432 \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u0448\u0442\u0430\u043c\u043f\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptretrievetimestamp\" rel=\"noopener noreferrer nofollow\"><code>CryptRetrieveTimeStamp<\/code><\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430 \u043d\u0430\u0441 \u0432\u0441\u044e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443: \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0445\u044d\u0448 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a TSA, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u043f\u043e HTTP, \u0447\u0438\u0442\u0430\u0435\u0442 \u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 TSA, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u043e\u043a\u0435\u043d\u0430 \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 TSA (\u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u043d \u0444\u043b\u0430\u0433 <code>TIMESTAMP_VERIFY_CONTEXT_SIGNATURE<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0442\u043e\u043a\u0435\u043d \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u0430 TSA (\u043f\u043e\u043b\u0435 <code>pbEncoded<\/code> \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/ns-wincrypt-crypt_timestamp_context\" rel=\"noopener noreferrer nofollow\"><code>CRYPT_TIMESTAMP_CONTEXT<\/code><\/a>).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0431\u043b\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438 c \u043e\u0442\u0432\u0435\u0442\u043e\u043c TSA \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmemfree\" rel=\"noopener noreferrer nofollow\"><code>CryptMemFree<\/code><\/a>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u043e\u043a\u0435\u043d, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0432 \u043f. 4, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b, \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044f \u0435\u0433\u043e \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043a \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e. \u041f\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u042d\u0422\u0420\u0410\u041d \u041e\u0410\u041e &#171;\u0420\u0416\u0414&#187;, \u0433\u0434\u0435 \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 CMS.<\/p>\n<h3>\u0412\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0448\u0442\u0430\u043c\u043f\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &#8212; \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043d\u0435\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u0422\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc5126#section-4.4.1\" rel=\"noopener noreferrer nofollow\"><code>CAdES-T<\/code><\/a> \u0438 \u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445. WinAPI \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u0438 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443, \u043f\u0440\u0430\u0432\u0434\u0430 \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0418 \u0432\u043d\u043e\u0432\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043e\u0434\u0438\u043d \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary> \/\/\/ Calculates and adds a timestamp token to a CMS message as an unsigned attribute \/\/\/ &lt;\/summary> \/\/\/ &lt;param name=\"cms\">A target CMS message&lt;\/param> \/\/\/ &lt;param name=\"detachedSignature\">A flag of the detached signature in the CMS&lt;\/param> \/\/\/ &lt;param name=\"signerIndex\">An index of the CMS signer&lt;\/param> \/\/\/ &lt;param name=\"tspDigestOid\">An OID of a message digest algorithm&lt;\/param> \/\/\/ &lt;param name=\"nonce\">A nonce value, can be empty&lt;\/param> \/\/\/ &lt;param name=\"tsaUri\">An URI of a TSA&lt;\/param> \/\/\/ &lt;param name=\"timeout\">A TSA request timeout&lt;\/param> \/\/\/ &lt;returns>A new CMS message with an injected timestamp token&lt;\/returns> public static unsafe byte[] AddTimestampToCms(ReadOnlySpan&lt;byte> cms, bool detachedSignature, uint signerIndex, Oid tspDigestOid, ReadOnlySpan&lt;byte> nonce, string tsaUri, TimeSpan timeout) { var hMsg = CryptMsgOpenToDecode(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, detachedSignature ? CMSG_DETACHED_FLAG : 0U, 0, 0, 0, 0) .VerifyWinapiNonzero(); try { \/\/ load the CMS signed message fixed (byte* pCms = cms) CryptMsgUpdate(hMsg, (nint)pCms, (uint)cms.Length, true).VerifyWinapiTrue();  \/\/ extract the signature from the CMS message for the specified signerIndex var signatureLength = 0; CryptMsgGetParam(hMsg, CMSG_ENCRYPTED_DIGEST, signerIndex, 0, (nint)(&amp;signatureLength)).VerifyWinapiTrue(); var signature = stackalloc byte[signatureLength]; CryptMsgGetParam(hMsg, CMSG_ENCRYPTED_DIGEST, signerIndex, (nint)signature, (nint)(&amp;signatureLength)).VerifyWinapiTrue();  \/\/ receive timestamp on the extracted signature var tst = RetriveTimestamp(new ReadOnlySpan&lt;byte>(signature, signatureLength), tspDigestOid, nonce, tsaUri, timeout);  \/\/ add a new unsigned attribute fixed (byte* pzdObjId = \"1.2.840.113549.1.9.16.2.14\"u8, pTst = tst) { var tstBlob = new CRYPT_INTEGER_BLOB(); tstBlob.cbData = (uint)tst.Length; tstBlob.pbData = (nint)pTst;  var tstAttr = new CRYPT_ATTRIBUTE(); tstAttr.pszObjId = (nint)pzdObjId; tstAttr.cValue = 1; tstAttr.rgValue = (nint)(&amp;tstBlob);  \/\/ encode a timestamp attribute to DER var attr = (nint)0; var attrLen = 0U; CryptEncodeObjectEx(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, PKCS_ATTRIBUTE, (nint)(&amp;tstAttr), CRYPT_ENCODE_ALLOC_FLAG, 0, (nint)(&amp;attr), (nint)(&amp;attrLen)).VerifyWinapiTrue(); try { \/\/ inject the encoded unsigned attribute to the SignerInfo var cmsAttr = new CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA(); cmsAttr.dwSignerIndex = signerIndex; cmsAttr.blob.cbData = attrLen; cmsAttr.blob.pbData = attr; CryptMsgControl(hMsg, 0, CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR, (nint)(&amp;cmsAttr)).VerifyWinapiTrue(); } finally { LocalFree(attr).VerifyWinapiZero(); } }  \/\/ extract the updated CMS message uint updatedCmsLength = 0; CryptMsgGetParam(hMsg, CMSG_ENCODED_MESSAGE, 0, 0, (nint)(&amp;updatedCmsLength)).VerifyWinapiTrue(); var updatedCms = new byte[updatedCmsLength]; fixed (byte* pUpdatedCms = updatedCms) CryptMsgGetParam(hMsg, CMSG_ENCODED_MESSAGE, 0, (nint)pUpdatedCms, (nint)(&amp;updatedCmsLength)).VerifyWinapiTrue(); return updatedCms; } finally { CryptMsgClose(hMsg); } } <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0437\u043e\u0432\u043e\u043c <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsgopentodecode\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgOpenToDecode<\/code><\/a> \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0443\u0441\u0442\u043e\u0435 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u044f <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsgupdate\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgUpdate<\/code><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0441\u0430\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>signerIndex<\/code> (\u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u043e\u0432, \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e): <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsggetparam\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgGetParam(hMsg, CMSG_ENCRYPTED_DIGEST, ...)<\/code><\/a>. \u0418\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>RetriveTimestamp<\/code> \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptencodeobjectex\" rel=\"noopener noreferrer nofollow\"><code>CryptEncodeObjectEx<\/code><\/a> \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0448\u0442\u0430\u043c\u043f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 CMS-\u0430\u0442\u0440\u0438\u0431\u0443\u0442 <a href=\"https:\/\/oidref.com\/1.2.840.113549.1.9.16.2.14\" rel=\"noopener noreferrer nofollow\"><code>id-aa-timeStampToken<\/code><\/a> c OID=1.2.840.113549.1.9.16.2.14. \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/ns-wincrypt-cmsg_ctrl_add_signer_unauth_attr_para\" rel=\"noopener noreferrer nofollow\"><code>CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR_PARA<\/code><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u043e\u0432\u043e\u043c <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsgcontrol\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgControl(..., CMSG_CTRL_ADD_SIGNER_UNAUTH_ATTR, ...)<\/code><\/a> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u0442\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>signerIndex<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u043b\u044e\u0431\u0435\u0437\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043f\u0440\u0438 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043d\u0430 \u0448\u0430\u0433\u0435 5, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0443\u044e <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/winbase\/nf-winbase-localfree\" rel=\"noopener noreferrer nofollow\"><code>LocalFree<\/code><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u043e\u0435 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u044b\u0432\u043e\u0432 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsggetparam\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgGetParam(hMsg, CMSG_ENCODED_MESSAGE, ...)<\/code><\/a> \u0432 \u0432\u0438\u0434\u0435 \u0431\u0430\u0439\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 CMS-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0432\u044b\u0437\u044b\u0432\u0430\u044f <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/wincrypt\/nf-wincrypt-cryptmsgclose\" rel=\"noopener noreferrer nofollow\"><code>CryptMsgClose<\/code><\/a>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0431\u0430\u0439\u0442\u043e\u0432\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0442\u0430\u043c, \u0433\u0434\u0435 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041f\u043e\u043b\u044c\u0437\u0443\u044f\u0441\u044c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0441 WinAPI, \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0431\u043e\u0448\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 .NET 7 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043a\u0440\u0438\u043f\u0442\u043e\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041d\u043e, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434 Windows. \u041f\u043e\u0434 Linux, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u044b\u0437\u043e\u0432\u044b \u043a OpenSSL; \u043d\u043e \u044d\u0442\u043e, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b P\/Invoke \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 <a href=\"https:\/\/github.com\/AntoineLarine\/NetWinapiCms\" rel=\"noopener noreferrer nofollow\">GitHub<\/a>.<\/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\/articles\/771162\/\"> https:\/\/habr.com\/ru\/articles\/771162\/<\/a><br \/><\/br><\/br><\/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-359018","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/359018","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=359018"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/359018\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=359018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=359018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=359018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}