Примеры - API КриптоАРМ

Примеры

Генерация запроса на сертификат с формированием нового ключевого набора:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
const certReq = new trusted.pki.CertificationRequest();
const exts = new trusted.pki.ExtensionCollection();
const oid = new trusted.pki.Oid("keyUsage");
const ext = new trusted.pki.Extension(oid, "critical,digitalSignature");
exts.push(ext);
const atrs = [
{ type: "C", value: "RU" },
{ type: "CN", value: "Иван Иванов 2001" },
{ type: "L", value: "Yoshkar-Ola" },
{ type: "S", value: "Mari El" },
{ type: "O", value: "Test Org" },
{ type: "1.2.643.100.3", value: "12295279882" },
{ type: "1.2.643.3.131.1.1", value: "002465363366" }
];
certReq.subject = atrs;
certReq.version = 2;
certReq.extensions = exts;
certReq.exportableFlag = true;
certReq.pubKeyAlgorithm = "gost2012-256";
certReq.containerName = "containerName2012_256";
certReq.save("./certreq.req", trusted.DataFormat.PEM);