Skip to content

Commit

Permalink
man
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT committed Nov 2, 2024
1 parent b6792af commit 798f211
Show file tree
Hide file tree
Showing 7 changed files with 537 additions and 4 deletions.
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ <h3>SIGNING</h3>
<div><ul>
<li>PBMAC1</li>
<li>ECDSA</li>
<li>CAdES</li>
<li>RSA</li>
<li><a href="man/CAdES.htm">CAdES</a></li>
<li>ДСТУ 4145:2014</li>
<li>ДСТУ 7564:2014</li>
</div>
</section>
Expand Down
5 changes: 2 additions & 3 deletions lib/services/crt.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@ defmodule CA.CRT do
def oid({1,2,840,113549,1,9,3},v), do: {:contentType, CA.AT.oid(CA.EST.decodeObjectIdentifier(v)) }
def oid({1,2,840,113549,1,9,4},v), do: {:messageDigest, :base64.encode(:erlang.element(2,:KEP.decode(:MessageDigest, v)))}
def oid({1,2,840,113549,1,9,5},v), do: {:signingTime, :erlang.element(2,:erlang.element(1,:asn1rt_nif.decode_ber_tlv(v)))}
def oid({1,2,840,113549,1,9,16,2},v), do: {:"id-aa", v}
def oid({1,2,840,113549,1,9,16,2,14},v) do
{:ok, {:ContentInfo, oid, value}} = :KEP.decode(:ContentInfo,v)
{:ok, {:SignedData, _, _alg, {_,_,x}, _c, _x1, _si}} = :KEP.decode(:SignedData, value)
{:ok, {:TSTInfo, _vsn, _oid, {:MessageImprint, _, x}, serial, ts, _,_,_,_}} = :KEP.decode(:TSTInfo, x)
{:timeStampToken, {hd(mapOids([oid])), serial, :erlang.iolist_to_binary(ts), :base64.encode(x)}}
end
def oid({1,2,840,113549,1,9,16,2,18},v) do {:"id-aa-ets-signerAttr", v} end
def oid({1,2,840,113549,1,9,16,2,19},v) do {:"id-aa-ets-otherSigCert", v} end
def oid({1,2,840,113549,1,9,16,2,18},v) do {:signerAttr, v} end
def oid({1,2,840,113549,1,9,16,2,19},v) do {:otherSigCert, v} end
def oid({1,2,840,113549,1,9,16,2,20},v) do
{:ok, {:ContentInfo, oid, value}} = :KEP.decode(:ContentInfo,v)
{:ok, {:SignedData, _, _alg, {_,_,x}, _c, _x1, _si}} = :KEP.decode(:SignedData, value)
Expand Down
121 changes: 121 additions & 0 deletions man/CAdES-BES-DSTU-4145.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<html><head><meta charset="utf-8" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" /><meta name="author" content="Maxim Sokhatsky" />
<title>CAdES</title>
<link rel="stylesheet" href="https://n2o.dev/blank.css" />
<link rel="stylesheet" href="https://n2o.dev/zima.css" />
<link rel="stylesheet" href="https://n2o.dev/pro/pro.css" />
</head><body><nav>
<a href="https://erp.uno">ERP</a>
<a href="https://authority.erp.uno">CA</a>
<a href="https://authority.erp.uno/man/CAdES.htm">CAdES</a>
<a href="#" style="background:#ededed;">BES ДСТУ-4145</a>
</nav><header>
<a href="../index.html"><img src="https://openmoji.org/data/color/svg/E08F.svg" /></a>
<h1>CAdES</h1>
</header><main>
<section>

<h3>BES ДСТУ-4145</h3>

<figure><code>
> CA.CMS.parseContentInfoFile "test/CAdES/CAdES-BES-DSTU-4145.p7s"
[
resourceType: :SignedData,
version: :v1,
cert: [
[
resourceType: :Certificate,
version: :v3,
signatureAlgorithm: :"dstu4145WithGost34311-pb",
subject: [
cn: "ТЕСТ Тестовий Тест Тестович",
sn: "Тестовий",
givenName: "Тест Тестович",
serialNumber: "1058",
c: "UA",
l: "Київ"
],
issuer: [
o: "ДП \"ДІЯ\" (ТЕСТ)",
cn: "Адміністратор ІТС ЦЗО (CA TEST)",
serialNumber: "UA-43395033-2101",
c: "UA",
l: "Київ",
organizationIdentifier: "NTRUA-43395033"
],
serial: "AhQ2MEOAPpo0HAQAAAAiBAAA+XgAAA==",
validity: [from: '240303220000Z', to: '260303215959Z'],
publicKey: [
key: <<4, 33, 91, 177, 14, 11, 252, 136, 216, 23, 38, 65, 187, 197, 216,
35, 74, 43, 11, 64, 60, 163, 34, 100, 204, 35, 145, 239, 135, 242,
217, 222, 35, 110, 1>>,
scheme: :"dstu4145WithGost34311-pb",
field: {:DSTU4145Params,
{:ecbinary,
{:ECBinary, 0, {:BinaryField, 257, {:t, 12}}, 0,
<<16, 190, 227, 219, 106, 234, 158, 31, 134, 87, 140, 69, 193, 37,
148, 255, 148, 35, 148, 167, 215, 56, 249, 24, 126, 101, ...>>,
57896044618658097711785492504343953926772365604796032451169741553099060627213,
<<182, 15, 210, 216, 220, 232, 169, 52, 35, 198, 16, 27, 202, 145,
196, 122, 0, 126, 108, 48, 11, 38, 205, 85, ...>>}},
<<169, 214, 235, 69, 241, 60, 112, 130, 128, 196, 150, 123, 35, 31, 94,
173, 246, 88, 235, 164, 192, 55, 41, 29, 56, 217, 107, 240, 37, 202,
78, 23, ...>>}
],
extensions: [
subjectKeyIdentifier: "igFayiwDI1Vfh0ROFRArg3OA4ZmOoAQKtTxbsxzEAOo=",
authorityKeyIdentifier: "NjBDgD6aNByal5kSRWH423OMfj+3vaPxn+Y3qLHDyiA=",
keyUsage: [:digitalSignature, :nonRepudiation],
certificatePolicies: ["1.2.804.2.1.1.1.2.2", "1.3.6.1.5.5.7.2.1",
"https://ca-test.czo.gov.ua/cps"],
basicConstraints: [],
qcStatements: ["0.4.0.1862.1.1", "0.4.0.1862.1.2", "UAH", "0.15.66.64",
"0.0", "0.4.0.1862.1.5", "https://ca-test.czo.gov.ua/reglament", "en",
"1.2.804.2.1.1.1.2.1"],
subjectAltName: ["[email protected]", "1.3.6.1.4.1.311.20.2.3", "1"],
cRLDistributionPoints: ["http://ca-test.czo.gov.ua/download/crls/TestCSK-2021-Full.crl"],
freshestCRL: ["http://ca-test.czo.gov.ua/download/crls/TestCSK-2021-Delta.crl"],
authorityInfoAccess: [
{"1.3.6.1.5.5.7.48.2",
"https://ca-test.czo.gov.ua/download/certificates/TestCA2021.p7b"},
{"1.3.6.1.5.5.7.48.1", "http://ca-test.czo.gov.ua/services/ocsp/"}
],
subjectInfoAccess: [
{"1.3.6.1.5.5.7.48.3", "http://ca-test.czo.gov.ua/services/tsp/"}
]
]
]
],
signerInfo: [
[
resourceType: :SignerInfo,
issuer: [
o: "ДП \"ДІЯ\" (ТЕСТ)",
cn: "Адміністратор ІТС ЦЗО (CA TEST)",
serialNumber: "UA-43395033-2101",
c: "UA",
l: "Київ",
organizationIdentifier: "NTRUA-43395033"
],
keyAlg: :gost34311,
signatureAlg: :"dstu4145WithGost34311-pb",
signedAttrs: [
contentType: :data,
signingTime: "240304082625Z",
messageDigest: "vhSPLtug9UJy3ZGsXHecfG28cC7KmSiw96+Y0foq+Tg=",
signingCertificateV2: 309361817556530004395837158894224188190313938944,
contentTimestamp: {"1.2.840.113549.1.7.2", 4585411, "20240304082626Z",
"vhSPLtug9UJy3ZGsXHecfG28cC7KmSiw96+Y0foq+Tg="}
],
attrs: []
]
],
signedContent: "Test\r\n"
]
</code></figure>
<br><center>&dot;</center>

</section>
</main><footer> <br><center>&dot;</center><br> 2005—2024 © Synrc Research Center
</footer></body></html>
121 changes: 121 additions & 0 deletions man/CAdES-BES-DSTU-7564.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<html><head><meta charset="utf-8" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" /><meta name="author" content="Maxim Sokhatsky" />
<title>CAdES</title>
<link rel="stylesheet" href="https://n2o.dev/blank.css" />
<link rel="stylesheet" href="https://n2o.dev/zima.css" />
<link rel="stylesheet" href="https://n2o.dev/pro/pro.css" />
</head><body><nav>
<a href="https://erp.uno">ERP</a>
<a href="https://authority.erp.uno">CA</a>
<a href="https://authority.erp.uno/man/CAdES.htm">CAdES</a>
<a href="#" style="background:#ededed;">BES ДСТУ-7564</a>
</nav><header>
<a href="../index.html"><img src="https://openmoji.org/data/color/svg/E08F.svg" /></a>
<h1>CAdES</h1>
</header><main>
<section>

<h3>BES ДСТУ-7564</h3>

<figure><code>
> CA.CMS.parseContentInfoFile "test/CAdES/CAdES-BES-DSTU-7564.p7s"
[
resourceType: :SignedData,
version: :v1,
cert: [
[
resourceType: :Certificate,
version: :v3,
signatureAlgorithm: :"dstu4145WithDstu7564-256-pb",
subject: [
cn: "ТЕСТ Тестовий Тест Тестович",
sn: "Тестовий",
givenName: "Тест Тестович",
serialNumber: "TINUA-0000000000",
c: "UA",
l: "Київ"
],
issuer: [
o: "ДП \"ДІЯ\" (ТЕСТ)",
cn: "Адміністратор ІТС ЦЗО (CA TEST)",
serialNumber: "UA-43395033-2101",
c: "UA",
l: "Київ",
organizationIdentifier: "NTRUA-43395033"
],
serial: "AhQ2MEOAPpo0HAQAAAAdBAAA93gAAA==",
validity: [from: '240303220000Z', to: '260303215959Z'],
publicKey: [
key: <<4, 33, 121, 221, 152, 77, 236, 173, 201, 100, 250, 238, 92, 70,
157, 98, 227, 160, 152, 230, 29, 146, 58, 153, 226, 211, 120, 225,
225, 99, 186, 145, 229, 220, 0>>,
scheme: :"dstu4145WithGost34311-pb",
field: {:DSTU4145Params,
{:ecbinary,
{:ECBinary, 0, {:BinaryField, 257, {:t, 12}}, 0,
<<16, 190, 227, 219, 106, 234, 158, 31, 134, 87, 140, 69, 193, 37,
148, 255, 148, 35, 148, 167, 215, 56, 249, 24, 126, 101, ...>>,
57896044618658097711785492504343953926772365604796032451169741553099060627213,
<<182, 15, 210, 216, 220, 232, 169, 52, 35, 198, 16, 27, 202, 145,
196, 122, 0, 126, 108, 48, 11, 38, 205, 85, ...>>}}, :asn1_NOVALUE}
],
extensions: [
subjectKeyIdentifier: "kp9aEWgtlEkSLr8vGQioMLDN/LQmNdmqECPmQmwTpns=",
authorityKeyIdentifier: "NjBDgD6aNByal5kSRWH423OMfj+3vaPxn+Y3qLHDyiA=",
keyUsage: [:digitalSignature, :nonRepudiation],
certificatePolicies: ["1.2.804.2.1.1.1.2.2", "1.3.6.1.5.5.7.2.1",
"https://ca-test.czo.gov.ua/cps"],
basicConstraints: [],
qcStatements: ["0.4.0.1862.1.1", "0.4.0.1862.1.2", "UAH", "0.15.66.64",
"0.0", "0.4.0.1862.1.5", "https://ca-test.czo.gov.ua/reglament", "en",
"1.3.6.1.5.5.7.11.2", "0.4.0.194121.1.1", "1.2.804.2.1.1.1.2.1"],
subjectAltName: ["[email protected]", "1.3.6.1.4.1.311.20.2.3", "1"],
cRLDistributionPoints: ["http://ca-test.czo.gov.ua/download/crls/TestCSK-2021-Full.crl"],
freshestCRL: ["http://ca-test.czo.gov.ua/download/crls/TestCSK-2021-Delta.crl"],
authorityInfoAccess: [
{"1.3.6.1.5.5.7.48.2",
"https://ca-test.czo.gov.ua/download/certificates/TestCA2021.p7b"},
{"1.3.6.1.5.5.7.48.1", "http://ca-test.czo.gov.ua/services/ocsp/"}
],
subjectInfoAccess: [
{"1.3.6.1.5.5.7.48.3", "http://ca-test.czo.gov.ua/services/tsp/"}
],
subjectDirectoryAttributes: [
{"1.2.804.2.1.1.1.11.1.4.1.1", "0000000000"}
]
]
]
],
signerInfo: [
[
resourceType: :SignerInfo,
issuer: [
o: "ДП \"ДІЯ\" (ТЕСТ)",
cn: "Адміністратор ІТС ЦЗО (CA TEST)",
serialNumber: "UA-43395033-2101",
c: "UA",
l: "Київ",
organizationIdentifier: "NTRUA-43395033"
],
keyAlg: :"dstu7564-256",
signatureAlg: :"dstu4145WithDstu7564-256-pb",
signedAttrs: [
contentType: :data,
signingTime: "240304095950Z",
messageDigest: "oC/g31yiEqnBJBMJHL/WfWeoMlawXZNYvah4ZQqtQCk=",
signingCertificateV2: 309361817556530004395837158893863900220090744832,
contentTimestamp: {"1.2.840.113549.1.7.2", 4611304, "20240304095951Z",
"oC/g31yiEqnBJBMJHL/WfWeoMlawXZNYvah4ZQqtQCk="}
],
attrs: []
]
],
signedContent: "Test\r\n"
]
</code></figure>
<br><center>&dot;</center>

</section>
</main><footer> <br><center>&dot;</center><br> 2005—2023 © Synrc Research Center
</footer></body></html>
115 changes: 115 additions & 0 deletions man/CAdES-BES-ECDSA.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<html><head><meta charset="utf-8" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" /><meta name="author" content="Maxim Sokhatsky" />
<title>CAdES</title>
<link rel="stylesheet" href="https://n2o.dev/blank.css" />
<link rel="stylesheet" href="https://n2o.dev/zima.css" />
<link rel="stylesheet" href="https://n2o.dev/pro/pro.css" />
</head><body><nav>
<a href="https://erp.uno">ERP</a>
<a href="https://authority.erp.uno">CA</a>
<a href="https://authority.erp.uno/man/CAdES.htm">CAdES</a>
<a href="#" style="background:#ededed;">BES ДСТУ-7564</a>
</nav><header>
<a href="../index.html"><img src="https://openmoji.org/data/color/svg/E08F.svg" /></a>
<h1>CAdES</h1>
</header><main>
<section>

<h3>BES ECDSA</h3>

<figure><code>
> CA.CMS.parseContentInfoFile "test/CAdES/CAdES-BES-ECDSA.p7s"
[
resourceType: :SignedData,
version: :v1,
cert: [
[
resourceType: :Certificate,
version: :v3,
signatureAlgorithm: :"ecdsa-with-SHA256",
subject: [
cn: "TEST Testovyi Test",
sn: "Testovyi",
givenName: "Test",
serialNumber: "TINUA-1234567892",
c: "UA",
stateOrProvinceName: "Kyiv"
],
issuer: [
o: "SE \"DIIA\" (TEST)",
cn: "Administrator ITS CCA (CA TEST)",
serialNumber: "UA-43395033-2103",
c: "UA",
l: "Kyiv",
organizationIdentifier: "NTRUA-43395033"
],
serial: "AhQ4DG1DaHVM1AQAAAALCAAA/ngAAA==",
validity: [from: '240303220000Z', to: '260303215959Z'],
publicKey: [
x: 28273171398966487279252849859935782854380167642855015676032950615658435636551,
y: 14270082180422333388068815404593533058387584764470228336285637871520597981100,
scheme: :"id-ecPublicKey",
curve: :secp256r1
],
extensions: [
subjectKeyIdentifier: "SFzrmnjq0Z/RoS8zgw0IPsbf+mA=",
authorityKeyIdentifier: "uAxtQ2h1TNSA1tLEniBLmBnCKPg=",
keyUsage: [:digitalSignature, :nonRepudiation, :keyAgreement],
certificatePolicies: ["1.2.804.2.1.1.1.2.2", "1.3.6.1.5.5.7.2.1",
"https://ca-test.czo.gov.ua/cps"],
basicConstraints: [],
qcStatements: ["0.4.0.1862.1.1", "0.4.0.1862.1.2", "UAH", "0.15.66.64",
"0.0", "0.4.0.1862.1.5", "https://ca-test.czo.gov.ua/reglament", "en",
"0.4.0.1862.1.7", "UA", "1.3.6.1.5.5.7.11.2", "0.4.0.194121.1.1",
"1.2.804.2.1.1.1.2.1"],
subjectAltName: ["[email protected]"],
cRLDistributionPoints: ["http://ca-test.czo.gov.ua/download/crls/TestCSK-ECDSA-2021-Full.crl"],
freshestCRL: ["http://ca-test.czo.gov.ua/download/crls/TestCSK-ECDSA-2021-Delta.crl"],
authorityInfoAccess: [
{"1.3.6.1.5.5.7.48.2",
"https://ca-test.czo.gov.ua/download/certificates/TestCA2021.p7b"},
{"1.3.6.1.5.5.7.48.1", "http://ca-test.czo.gov.ua/services/ocsp/"}
],
subjectInfoAccess: [
{"1.3.6.1.5.5.7.48.3",
"http://ca-test.czo.gov.ua/services/tsp/ecdsa/"}
],
subjectDirectoryAttributes: [
{"1.2.804.2.1.1.1.11.1.4.1.1", "1234567892"}
]
]
]
],
signerInfo: [
[
resourceType: :SignerInfo,
issuer: [
o: "SE \"DIIA\" (TEST)",
cn: "Administrator ITS CCA (CA TEST)",
serialNumber: "UA-43395033-2103",
c: "UA",
l: "Kyiv",
organizationIdentifier: "NTRUA-43395033"
],
keyAlg: :sha256,
signatureAlg: :"ecdsa-with-SHA256",
signedAttrs: [
contentType: :data,
signingTime: "240304105050Z",
messageDigest: "fdkeB/A0FkbVP2k4J4pNPoeWH6vqBm9+b0C3OY87Cw8=",
signingCertificateV2: 319980610285451294959334116032709222651938734080,
contentTimestamp: {"1.2.840.113549.1.7.2", 4625554, "20240304105050Z",
"fdkeB/A0FkbVP2k4J4pNPoeWH6vqBm9+b0C3OY87Cw8="}
],
attrs: []
]
],
signedContent: "Test\r\n"
]
</code></figure>
<br><center>&dot;</center>

</section>
</main><footer> <br><center>&dot;</center><br> 2005—2024 © Synrc Research Center
</footer></body></html>
Loading

0 comments on commit 798f211

Please sign in to comment.