node-opcua-crypto 4.9.4 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +119 -114
  3. package/dist/{chunk-WLW5XUML.mjs → chunk-2RCYFHGG.mjs} +755 -724
  4. package/dist/chunk-2RCYFHGG.mjs.map +1 -0
  5. package/dist/chunk-C7PROBPE.mjs +14 -0
  6. package/dist/chunk-C7PROBPE.mjs.map +1 -0
  7. package/dist/{chunk-UEV3YRUV.mjs → chunk-UH5AT3JE.mjs} +9 -15
  8. package/dist/chunk-UH5AT3JE.mjs.map +1 -0
  9. package/dist/index.d.mts +3 -2
  10. package/dist/index.d.ts +3 -2
  11. package/dist/index.js +553 -552
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +9 -52
  14. package/dist/index_web-C5Oeu9mq.d.mts +503 -0
  15. package/dist/index_web-D1qc4UN2.d.ts +503 -0
  16. package/dist/source/index.d.mts +11 -516
  17. package/dist/source/index.d.ts +11 -516
  18. package/dist/source/index.js +537 -529
  19. package/dist/source/index.js.map +1 -1
  20. package/dist/source/index.mjs +9 -50
  21. package/dist/source/index_web.d.mts +1 -1
  22. package/dist/source/index_web.d.ts +1 -1
  23. package/dist/source/index_web.js +525 -522
  24. package/dist/source/index_web.js.map +1 -1
  25. package/dist/source/index_web.mjs +5 -49
  26. package/dist/source_nodejs/index.d.mts +1 -2
  27. package/dist/source_nodejs/index.d.ts +1 -2
  28. package/dist/source_nodejs/index.js +33 -41
  29. package/dist/source_nodejs/index.js.map +1 -1
  30. package/dist/source_nodejs/index.mjs +3 -5
  31. package/package.json +9 -4
  32. package/dist/chunk-5NV4OKIV.mjs +0 -1
  33. package/dist/chunk-5NV4OKIV.mjs.map +0 -1
  34. package/dist/chunk-UEV3YRUV.mjs.map +0 -1
  35. package/dist/chunk-WLW5XUML.mjs.map +0 -1
  36. package/dist/index_web.d.mts +0 -4
  37. package/dist/index_web.d.ts +0 -4
  38. package/dist/index_web.js +0 -6365
  39. package/dist/index_web.js.map +0 -1
  40. package/dist/index_web.mjs +0 -192
  41. package/dist/index_web.mjs.map +0 -1
  42. package/index.mjs +0 -1
  43. package/index_web.ts +0 -1
  44. package/web.d.ts +0 -1
  45. package/web.mjs +0 -1
@@ -0,0 +1,14 @@
1
+ import {
2
+ readAlgorithmIdentifier,
3
+ readSignatureValueBin,
4
+ readStruct,
5
+ readTag
6
+ } from "./chunk-2RCYFHGG.mjs";
7
+
8
+ // source/index.ts
9
+ var asn1 = { readTag, readStruct, readAlgorithmIdentifier, readSignatureValueBin };
10
+
11
+ export {
12
+ asn1
13
+ };
14
+ //# sourceMappingURL=chunk-C7PROBPE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../source/index.ts"],"sourcesContent":["// ---------------------------------------------------------------------------------------------------------------------\n// node-opcua-crypto\n// ---------------------------------------------------------------------------------------------------------------------\n// Copyright (c) 2014-2022 - Etienne Rossignon - etienne.rossignon (at) gadz.org\n// Copyright (c) 2022-2024 - Sterfive.com\n// ---------------------------------------------------------------------------------------------------------------------\n//\n// This project is licensed under the terms of the MIT license.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n// documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the\n// Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// ---------------------------------------------------------------------------------------------------------------------\n\n/**\n * @module node_opcua_crypto\n */\nexport * from \"./index_web.js\";\nimport { readTag, readStruct, readAlgorithmIdentifier, readSignatureValueBin } from \"./asn1.js\";\nexport const asn1 = { readTag, readStruct, readAlgorithmIdentifier, readSignatureValueBin };"],"mappings":";;;;;;;;AA4BO,IAAM,OAAO,EAAE,SAAS,YAAY,yBAAyB,sBAAsB;","names":[]}
@@ -6,12 +6,12 @@ import {
6
6
  privateKeyToPEM,
7
7
  removeTrailingLF,
8
8
  toPem
9
- } from "./chunk-WLW5XUML.mjs";
9
+ } from "./chunk-2RCYFHGG.mjs";
10
10
 
11
11
  // source_nodejs/read.ts
12
12
  import assert from "assert";
13
- import fs from "fs";
14
- import path from "path";
13
+ import fs from "node:fs";
14
+ import path from "node:path";
15
15
  import { createPrivateKey, createPublicKey } from "crypto";
16
16
  import sshpk from "sshpk";
17
17
  function _readPemFile(filename) {
@@ -52,9 +52,6 @@ function myCreatePrivateKey(rawKey) {
52
52
  process.env.OPENSSL_CONF = backup;
53
53
  return { hidden: retValue };
54
54
  }
55
- function makePrivateKeyThumbPrint(privateKey) {
56
- return Buffer.alloc(0);
57
- }
58
55
  function ensureTrailingLF(str) {
59
56
  return str.match(/\n$/) ? str : str + "\n";
60
57
  }
@@ -112,10 +109,9 @@ function readPublicRsaKey(filename) {
112
109
  }
113
110
 
114
111
  // source_nodejs/read_certificate_revocation_list.ts
115
- import fs2 from "fs";
116
- import { promisify } from "util";
112
+ import fs2 from "node:fs";
117
113
  async function readCertificateRevocationList(filename) {
118
- const crl = await promisify(fs2.readFile)(filename);
114
+ const crl = await fs2.promises.readFile(filename);
119
115
  if (crl[0] === 48 && crl[1] === 130) {
120
116
  return crl;
121
117
  }
@@ -124,10 +120,9 @@ async function readCertificateRevocationList(filename) {
124
120
  }
125
121
 
126
122
  // source_nodejs/read_certificate_signing_request.ts
127
- import fs3 from "fs";
128
- import { promisify as promisify2 } from "util";
123
+ import fs3 from "node:fs";
129
124
  async function readCertificateSigningRequest(filename) {
130
- const csr = await promisify2(fs3.readFile)(filename);
125
+ const csr = await fs3.promises.readFile(filename);
131
126
  if (csr[0] === 48 && csr[1] === 130) {
132
127
  return csr;
133
128
  }
@@ -136,7 +131,7 @@ async function readCertificateSigningRequest(filename) {
136
131
  }
137
132
 
138
133
  // source_nodejs/generate_private_key_filename.ts
139
- import fs4 from "fs";
134
+ import fs4 from "node:fs";
140
135
  import jsrsasign from "jsrsasign";
141
136
  async function generatePrivateKeyFile(privateKeyFilename, modulusLength) {
142
137
  const keys = await generateKeyPair(modulusLength);
@@ -156,7 +151,6 @@ async function generatePrivateKeyFileAlternate(privateKeyFilename, modulusLength
156
151
  export {
157
152
  readCertificate,
158
153
  readPublicKey,
159
- makePrivateKeyThumbPrint,
160
154
  readPrivateKey,
161
155
  readCertificatePEM,
162
156
  readPublicKeyPEM,
@@ -170,4 +164,4 @@ export {
170
164
  generatePrivateKeyFile,
171
165
  generatePrivateKeyFileAlternate
172
166
  };
173
- //# sourceMappingURL=chunk-UEV3YRUV.mjs.map
167
+ //# sourceMappingURL=chunk-UH5AT3JE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../source_nodejs/read.ts","../source_nodejs/read_certificate_revocation_list.ts","../source_nodejs/read_certificate_signing_request.ts","../source_nodejs/generate_private_key_filename.ts"],"sourcesContent":["// ---------------------------------------------------------------------------------------------------------------------\n// node-opcua-crypto\n// ---------------------------------------------------------------------------------------------------------------------\n// Copyright (c) 2014-2022 - Etienne Rossignon - etienne.rossignon (at) gadz.org\n// Copyright (c) 2022-2024 - Sterfive.com\n// ---------------------------------------------------------------------------------------------------------------------\n//\n// This project is licensed under the terms of the MIT license.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n// documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the\n// Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// ---------------------------------------------------------------------------------------------------------------------\n\nimport assert from \"assert\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { createPrivateKey, createPublicKey } from \"crypto\";\nimport { Certificate, CertificatePEM, DER, PEM, PublicKey, PublicKeyPEM, PrivateKeyPEM, PrivateKey } from \"../source/common.js\";\nimport { convertPEMtoDER, identifyPemType, removeTrailingLF, toPem } from \"../source/crypto_utils.js\";\nimport sshpk from \"sshpk\";\n\nfunction _readPemFile(filename: string): PEM {\n assert(typeof filename === \"string\");\n return removeTrailingLF(fs.readFileSync(filename, \"utf-8\"));\n}\n\nfunction _readPemOrDerFileAsDER(filename: string): DER {\n if (filename.match(/.*\\.der/)) {\n return fs.readFileSync(filename) as Buffer;\n }\n const raw_key: string = _readPemFile(filename);\n return convertPEMtoDER(raw_key);\n}\n\n/**\n * read a DER or PEM certificate from file\n */\nexport function readCertificate(filename: string): Certificate {\n return _readPemOrDerFileAsDER(filename) as Certificate;\n}\n\n/**\n * read a DER or PEM certificate from file\n */\nexport function readPublicKey(filename: string): PublicKey {\n if (filename.match(/.*\\.der/)) {\n const der = fs.readFileSync(filename) as Buffer;\n return createPublicKey(der);\n } else {\n const raw_key: string = _readPemFile(filename);\n return createPublicKey(raw_key);\n }\n}\n\n// console.log(\"createPrivateKey\", (crypto as any).createPrivateKey, process.env.NO_CREATE_PRIVATEKEY);\n\nfunction myCreatePrivateKey(rawKey: string | Buffer): PrivateKey {\n if (!createPrivateKey || process.env.NO_CREATE_PRIVATEKEY) {\n // we are not running nodejs or createPrivateKey is not supported in the environment\n if (rawKey instanceof Buffer) {\n const pemKey = toPem(rawKey, \"PRIVATE KEY\");\n assert([\"RSA PRIVATE KEY\", \"PRIVATE KEY\"].indexOf(identifyPemType(pemKey) as string) >= 0);\n return { hidden: pemKey };\n }\n return { hidden: ensureTrailingLF(rawKey) };\n }\n // see https://askubuntu.com/questions/1409458/openssl-config-cuases-error-in-node-js-crypto-how-should-the-config-be-updated\n const backup = process.env.OPENSSL_CONF;\n process.env.OPENSSL_CONF = \"/dev/null\";\n const retValue = createPrivateKey(rawKey);\n process.env.OPENSSL_CONF = backup;\n return { hidden: retValue };\n}\n\n\nfunction ensureTrailingLF(str: string): string {\n return str.match(/\\n$/) ? str : str + \"\\n\";\n}\n/**\n * read a DER or PEM certificate from file\n */\nexport function readPrivateKey(filename: string): PrivateKey {\n if (filename.match(/.*\\.der/)) {\n const der: Buffer = fs.readFileSync(filename);\n return myCreatePrivateKey(der);\n } else {\n const raw_key: string = _readPemFile(filename);\n return myCreatePrivateKey(raw_key);\n }\n}\n\nexport function readCertificatePEM(filename: string): CertificatePEM {\n return _readPemFile(filename);\n}\n\nexport function readPublicKeyPEM(filename: string): PublicKeyPEM {\n return _readPemFile(filename);\n}\n/**\n *\n * @deprecated\n */\nexport function readPrivateKeyPEM(filename: string): PrivateKeyPEM {\n return _readPemFile(filename);\n}\n\nlet _g_certificate_store: string = \"\";\n\nexport function setCertificateStore(store: string): string {\n const old_store = _g_certificate_store;\n _g_certificate_store = store;\n return old_store;\n}\nexport function getCertificateStore(): string {\n if (!_g_certificate_store) {\n _g_certificate_store = path.join(__dirname, \"../../certificates/\");\n }\n return _g_certificate_store;\n}\n/**\n *\n * @param filename\n */\nexport function readPrivateRsaKey(filename: string): PrivateKey {\n if (!createPrivateKey) {\n throw new Error(\"createPrivateKey is not supported in this environment\");\n }\n if (filename.substring(0, 1) !== \".\" && !fs.existsSync(filename)) {\n filename = path.join(getCertificateStore(),filename);\n }\n const content = fs.readFileSync(filename, \"utf8\");\n const sshKey = sshpk.parsePrivateKey(content, \"auto\");\n const key = sshKey.toString(\"pkcs1\") as PEM;\n const hidden = createPrivateKey({ format: \"pem\", type: \"pkcs1\", key });\n return { hidden };\n}\n\nexport function readPublicRsaKey(filename: string): PublicKey {\n if (filename.substring(0, 1) !== \".\" && !fs.existsSync(filename)) {\n filename = path.join(getCertificateStore(), filename);\n }\n const content = fs.readFileSync(filename, \"utf-8\");\n const sshKey = sshpk.parseKey(content, \"ssh\");\n const key = sshKey.toString(\"pkcs1\") as PEM;\n return createPublicKey({ format: \"pem\", type: \"pkcs1\", key });\n}\n","// ---------------------------------------------------------------------------------------------------------------------\n// node-opcua-crypto\n// ---------------------------------------------------------------------------------------------------------------------\n// Copyright (c) 2014-2022 - Etienne Rossignon - etienne.rossignon (at) gadz.org\n// Copyright (c) 2022-2024 - Sterfive.com\n// ---------------------------------------------------------------------------------------------------------------------\n//\n// This project is licensed under the terms of the MIT license.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n// documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the\n// Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// ---------------------------------------------------------------------------------------------------------------------\n\nimport fs from \"node:fs\";\nimport { convertPEMtoDER } from \"../source/crypto_utils.js\";\nimport { CertificateRevocationList } from \"../source/common.js\";\n\nexport async function readCertificateRevocationList(filename: string): Promise<CertificateRevocationList> {\n const crl = await fs.promises.readFile(filename);\n if (crl[0] === 0x30 && crl[1] === 0x82) {\n // der format\n return crl as CertificateRevocationList;\n }\n const raw_crl = crl.toString();\n return convertPEMtoDER(raw_crl);\n}\n","// ---------------------------------------------------------------------------------------------------------------------\n// node-opcua-crypto\n// ---------------------------------------------------------------------------------------------------------------------\n// Copyright (c) 2014-2022 - Etienne Rossignon - etienne.rossignon (at) gadz.org\n// Copyright (c) 2022-2024 - Sterfive.com\n// ---------------------------------------------------------------------------------------------------------------------\n//\n// This project is licensed under the terms of the MIT license.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n// documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the\n// Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// ---------------------------------------------------------------------------------------------------------------------\n\nimport fs from \"node:fs\";\nimport { convertPEMtoDER } from \"../source/crypto_utils.js\";\nimport { CertificateRevocationList } from \"../source/common.js\";\n\nexport type CertificateSigningRequest = Buffer;\n\nexport async function readCertificateSigningRequest(filename: string): Promise<CertificateSigningRequest> {\n const csr = await fs.promises.readFile(filename);\n if (csr[0] === 0x30 && csr[1] === 0x82) {\n // der format\n return csr as CertificateRevocationList;\n }\n const raw_crl = csr.toString();\n return convertPEMtoDER(raw_crl);\n}\n","// ---------------------------------------------------------------------------------------------------------------------\n// node-opcua-crypto\n// ---------------------------------------------------------------------------------------------------------------------\n// Copyright (c) 2014-2022 - Etienne Rossignon - etienne.rossignon (at) gadz.org\n// Copyright (c) 2022-2024 - Sterfive.com\n// ---------------------------------------------------------------------------------------------------------------------\n//\n// This project is licensed under the terms of the MIT license.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\n// documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n// permit persons to whom the Software is furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the\n// Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n// ---------------------------------------------------------------------------------------------------------------------\n\nimport fs from \"node:fs\";\nimport { generateKeyPair, privateKeyToPEM } from \"../source/index.js\";\nimport jsrsasign from \"jsrsasign\";\nexport async function generatePrivateKeyFile(privateKeyFilename: string, modulusLength: 1024 | 2048 | 3072 | 4096) {\n const keys = await generateKeyPair(modulusLength);\n const privateKeyPem = await privateKeyToPEM(keys.privateKey);\n await fs.promises.writeFile(privateKeyFilename, privateKeyPem.privPem, \"utf-8\");\n privateKeyPem.privPem = \"\";\n privateKeyPem.privDer = new Uint8Array(0);\n}\n\n/**\n * alternate function to generate PrivateKeyFile, using jsrsasign.\n * \n * This function is slower than generatePrivateKeyFile\n */\nexport async function generatePrivateKeyFileAlternate(privateKeyFilename: string, modulusLength: 2048 | 3072 | 4096) {\n \n const kp = jsrsasign.KEYUTIL.generateKeypair(\"RSA\", modulusLength);\n const prv = kp.prvKeyObj;\n const pub = kp.pubKeyObj;\n const prvpem = jsrsasign.KEYUTIL.getPEM(prv, \"PKCS8PRV\");\n // const pubpem = jsrsasign.KEYUTIL.getPEM(pub, \"PKCS8PUB\");\n await fs.promises.writeFile(privateKeyFilename, prvpem, \"utf-8\");\n}\n"],"mappings":";;;;;;;;;;;AAuBA,OAAO,YAAY;AACnB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,kBAAkB,uBAAuB;AAGlD,OAAO,WAAW;AAElB,SAAS,aAAa,UAAuB;AACzC,SAAO,OAAO,aAAa,QAAQ;AACnC,SAAO,iBAAiB,GAAG,aAAa,UAAU,OAAO,CAAC;AAC9D;AAEA,SAAS,uBAAuB,UAAuB;AACnD,MAAI,SAAS,MAAM,SAAS,GAAG;AAC3B,WAAO,GAAG,aAAa,QAAQ;AAAA,EACnC;AACA,QAAM,UAAkB,aAAa,QAAQ;AAC7C,SAAO,gBAAgB,OAAO;AAClC;AAKO,SAAS,gBAAg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AAM,UAAU,IAAI,SAAS;AAC7B,SAAO,gBAAgB,OAAO;AAClC;;;ACZA,OAAOC,SAAQ;AAMf,eAAsB,8BAA8B,UAAsD;AACtG,QAAM,MAAM,MAAMC,IAAG,SAAS,SAAS,QAAQ;AAC/C,MAAI,IAAI,CAAC,MAAM,MAAQ,IAAI,CAAC,MAAM,KAAM;AAEpC,WAAO;AAAA,EACX;AACA,QAAM,UAAU,IAAI,SAAS;AAC7B,SAAO,gBAAgB,OAAO;AAClC;;;ACdA,OAAOC,SAAQ;AAEf,OAAO,eAAe;AACtB,eAAsB,uBAAuB,oBAA4B,eAA0C;AAC/G,QAAM,OAAO,MAAM,gBAAgB,aAAa;AAChD,QAAM,gBAAgB,MAAM,gBAAgB,KAAK,UAAU;AAC3D,QAAMC,IAAG,SAAS,UAAU,oBAAoB,cAAc,SAAS,OAAO;AAC9E,gBAAc,UAAU;AACxB,gBAAc,UAAU,IAAI,WAAW,CAAC;AAC5C;AAOA,eAAsB,gCAAgC,oBAA4B,eAAmC;AAEjH,QAAM,KAAK,UAAU,QAAQ,gBAAgB,OAAO,aAAa;AACjE,QAAM,MAAM,GAAG;AACf,QAAM,MAAM,GAAG;AACf,QAAM,SAAS,UAAU,QAAQ,OAAO,KAAK,UAAU;AAEvD,QAAMA,IAAG,SAAS,UAAU,oBAAoB,QAAQ,OAAO;AACnE;","names":["fs","fs","fs","fs","fs","fs"]}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
+ export { asn1 } from './source/index.mjs';
2
+ export { CertificateSigningRequest, generatePrivateKeyFile, generatePrivateKeyFileAlternate, getCertificateStore, readCertificate, readCertificatePEM, readCertificateRevocationList, readCertificateSigningRequest, readPrivateKey, readPrivateKeyPEM, readPrivateRsaKey, readPublicKey, readPublicKeyPEM, readPublicRsaKey, setCertificateStore } from './source_nodejs/index.mjs';
3
+ export { A as AttributeTypeAndValue, d as AuthorityKeyIdentifier, B as BasicConstraints, C as CertificateExtension, ak as CertificateInfo, e as CertificateInternals, ac as CertificateRevocationListInfo, a8 as CertificateSerialNumber, ag as CertificateSigningRequestInfo, O as ComputeDerivedKeysOptions, aG as CreateSelfSignCertificateOptions, Q as DerivedKeys, af as ExtensionRequest, a9 as Extensions, a7 as Name, P as PaddingAlgorithm, an as PrivateKeyInternals, aj as PublicKeyLength, R as RSA_PKCS1_OAEP_PADDING, o as RSA_PKCS1_PADDING, aa as RevokedCertificate, as as Subject, ar as SubjectOptions, S as SubjectPublicKey, b as SubjectPublicKeyInfo, ab as TBSCertList, T as TbsCertificate, V as Validity, Z as VerifyChunkSignatureOptions, l as VerifyMessageChunkSignatureOptions, a6 as Version, a as X509ExtKeyUsage, X as X509KeyUsage, aw as _VerifyStatus, az as _coercePrivateKey, _ as _readExtension, c as certificateMatchesPrivateKey, al as coerceCertificate, D as coerceCertificatePem, ay as coercePEMorDerToPrivateKey, I as coercePrivateKeyPem, J as coercePublicKeyPem, K as coerceRsaPublicKeyPem, g as combine_der, U as computeDerivedKeys, a0 as computePaddingFooter, j as convertPEMtoDER, aA as createCertificateSigningRequest, aH as createSelfSignedCertificate, a2 as decryptBufferWithDerivedKeys, aE as derToPrivateKey, a1 as encryptBufferWithDerivedKeys, a5 as exploreAsn1, f as exploreCertificate, am as exploreCertificateInfo, ae as exploreCertificateRevocationList, ai as exploreCertificateSigningRequest, ao as explorePrivateKey, F as extractPublicKeyFromCertificate, E as extractPublicKeyFromCertificateSync, aB as generateKeyPair, aC as generatePrivateKey, k as hexDump, i as identifyPemType, m as makeMessageChunkSignature, a3 as makeMessageChunkSignatureWithDerivedKeys, ap as makePrivateKeyFromPem, aq as makePrivateKeyThumbPrint, N as makePseudoRandomBuffer, n as makeSHA1Thumbprint, aF as pemToPrivateKey, x as privateDecrypt, z as privateDecrypt_long, u as privateDecrypt_native, aD as privateKeyToPEM, w as publicEncrypt, y as publicEncrypt_long, q as publicEncrypt_native, p as publicKeyAndPrivateKeyMatches, ah as readCertificationRequestInfo, ad as readNameForCrl, r as readTbsCertificate, W as reduceLength, Y as removePadding, h as removeTrailingLF, G as rsaLengthPrivateKey, L as rsaLengthPublicKey, M as rsaLengthRsaPublicKey, s as split_der, t as toPem, H as toPem2, ax as verifyCertificateChain, at as verifyCertificateOrClrSignature, av as verifyCertificateRevocationListSignature, au as verifyCertificateSignature, $ as verifyChunkSignature, a4 as verifyChunkSignatureWithDerivedKeys, v as verifyMessageChunkSignature } from './index_web-C5Oeu9mq.mjs';
1
4
  export { C as Certificate, d as CertificatePEM, h as CertificatePurpose, g as CertificateRevocationList, D as DER, K as KeyObject, N as Nonce, b as PEM, P as PrivateKey, e as PrivateKeyPEM, a as PublicKey, f as PublicKeyPEM, S as Signature, c as createPrivateKeyFromNodeJSCrypto, i as isKeyObject } from './common-CFr95Map.mjs';
2
- export { AlgorithmIdentifier, AttributeTypeAndValue, AuthorityKeyIdentifier, BasicConstraints, BitString, BlockInfo, CertificateExtension, CertificateInfo, CertificateInternals, CertificateRevocationListInfo, CertificateSerialNumber, CertificateSigningRequestInfo, ComputeDerivedKeysOptions, CreateSelfSignCertificateOptions, DerivedKeys, DirectoryName, ExtensionRequest, Extensions, Name, PaddingAlgorithm, PrivateKeyInternals, PublicKeyLength, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, RevokedCertificate, SignatureValue, Subject, SubjectOptions, SubjectPublicKey, SubjectPublicKeyInfo, TBSCertList, TagType, TbsCertificate, Validity, VerifyChunkSignatureOptions, VerifyMessageChunkSignatureOptions, Version, X509ExtKeyUsage, X509KeyUsage, _VerifyStatus, _coercePrivateKey, _findBlockAtIndex, _getBlock, _readAlgorithmIdentifier, _readBitString, _readBooleanValue, _readDirectoryName, _readECCAlgorithmIdentifier, _readExtension, _readIntegerAsByteString, _readIntegerValue, _readListOfInteger, _readLongIntegerValue, _readObjectIdentifier, _readOctetString, _readSignatureValue, _readSignatureValueBin, _readStruct, _readTime, _readValue, _readVersionValue, certificateMatchesPrivateKey, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, compactDirectoryName, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateSigningRequest, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, formatBuffer2DigitHexWithColum, generateKeyPair, generatePrivateKey, hexDump, identifyPemType, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePseudoRandomBuffer, makeSHA1Thumbprint, parseBitString, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readNameForCrl, readTag, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyMessageChunkSignature } from './source/index.mjs';
3
- export { CertificateSigningRequest, generatePrivateKeyFile, generatePrivateKeyFileAlternate, getCertificateStore, makePrivateKeyThumbPrint, readCertificate, readCertificatePEM, readCertificateRevocationList, readCertificateSigningRequest, readPrivateKey, readPrivateKeyPEM, readPrivateRsaKey, readPublicKey, readPublicKeyPEM, readPublicRsaKey, setCertificateStore } from './source_nodejs/index.mjs';
4
5
  import 'crypto';
5
6
  import '@peculiar/x509';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ export { asn1 } from './source/index.js';
2
+ export { CertificateSigningRequest, generatePrivateKeyFile, generatePrivateKeyFileAlternate, getCertificateStore, readCertificate, readCertificatePEM, readCertificateRevocationList, readCertificateSigningRequest, readPrivateKey, readPrivateKeyPEM, readPrivateRsaKey, readPublicKey, readPublicKeyPEM, readPublicRsaKey, setCertificateStore } from './source_nodejs/index.js';
3
+ export { A as AttributeTypeAndValue, d as AuthorityKeyIdentifier, B as BasicConstraints, C as CertificateExtension, ak as CertificateInfo, e as CertificateInternals, ac as CertificateRevocationListInfo, a8 as CertificateSerialNumber, ag as CertificateSigningRequestInfo, O as ComputeDerivedKeysOptions, aG as CreateSelfSignCertificateOptions, Q as DerivedKeys, af as ExtensionRequest, a9 as Extensions, a7 as Name, P as PaddingAlgorithm, an as PrivateKeyInternals, aj as PublicKeyLength, R as RSA_PKCS1_OAEP_PADDING, o as RSA_PKCS1_PADDING, aa as RevokedCertificate, as as Subject, ar as SubjectOptions, S as SubjectPublicKey, b as SubjectPublicKeyInfo, ab as TBSCertList, T as TbsCertificate, V as Validity, Z as VerifyChunkSignatureOptions, l as VerifyMessageChunkSignatureOptions, a6 as Version, a as X509ExtKeyUsage, X as X509KeyUsage, aw as _VerifyStatus, az as _coercePrivateKey, _ as _readExtension, c as certificateMatchesPrivateKey, al as coerceCertificate, D as coerceCertificatePem, ay as coercePEMorDerToPrivateKey, I as coercePrivateKeyPem, J as coercePublicKeyPem, K as coerceRsaPublicKeyPem, g as combine_der, U as computeDerivedKeys, a0 as computePaddingFooter, j as convertPEMtoDER, aA as createCertificateSigningRequest, aH as createSelfSignedCertificate, a2 as decryptBufferWithDerivedKeys, aE as derToPrivateKey, a1 as encryptBufferWithDerivedKeys, a5 as exploreAsn1, f as exploreCertificate, am as exploreCertificateInfo, ae as exploreCertificateRevocationList, ai as exploreCertificateSigningRequest, ao as explorePrivateKey, F as extractPublicKeyFromCertificate, E as extractPublicKeyFromCertificateSync, aB as generateKeyPair, aC as generatePrivateKey, k as hexDump, i as identifyPemType, m as makeMessageChunkSignature, a3 as makeMessageChunkSignatureWithDerivedKeys, ap as makePrivateKeyFromPem, aq as makePrivateKeyThumbPrint, N as makePseudoRandomBuffer, n as makeSHA1Thumbprint, aF as pemToPrivateKey, x as privateDecrypt, z as privateDecrypt_long, u as privateDecrypt_native, aD as privateKeyToPEM, w as publicEncrypt, y as publicEncrypt_long, q as publicEncrypt_native, p as publicKeyAndPrivateKeyMatches, ah as readCertificationRequestInfo, ad as readNameForCrl, r as readTbsCertificate, W as reduceLength, Y as removePadding, h as removeTrailingLF, G as rsaLengthPrivateKey, L as rsaLengthPublicKey, M as rsaLengthRsaPublicKey, s as split_der, t as toPem, H as toPem2, ax as verifyCertificateChain, at as verifyCertificateOrClrSignature, av as verifyCertificateRevocationListSignature, au as verifyCertificateSignature, $ as verifyChunkSignature, a4 as verifyChunkSignatureWithDerivedKeys, v as verifyMessageChunkSignature } from './index_web-D1qc4UN2.js';
1
4
  export { C as Certificate, d as CertificatePEM, h as CertificatePurpose, g as CertificateRevocationList, D as DER, K as KeyObject, N as Nonce, b as PEM, P as PrivateKey, e as PrivateKeyPEM, a as PublicKey, f as PublicKeyPEM, S as Signature, c as createPrivateKeyFromNodeJSCrypto, i as isKeyObject } from './common-CFr95Map.js';
2
- export { AlgorithmIdentifier, AttributeTypeAndValue, AuthorityKeyIdentifier, BasicConstraints, BitString, BlockInfo, CertificateExtension, CertificateInfo, CertificateInternals, CertificateRevocationListInfo, CertificateSerialNumber, CertificateSigningRequestInfo, ComputeDerivedKeysOptions, CreateSelfSignCertificateOptions, DerivedKeys, DirectoryName, ExtensionRequest, Extensions, Name, PaddingAlgorithm, PrivateKeyInternals, PublicKeyLength, RSA_PKCS1_OAEP_PADDING, RSA_PKCS1_PADDING, RevokedCertificate, SignatureValue, Subject, SubjectOptions, SubjectPublicKey, SubjectPublicKeyInfo, TBSCertList, TagType, TbsCertificate, Validity, VerifyChunkSignatureOptions, VerifyMessageChunkSignatureOptions, Version, X509ExtKeyUsage, X509KeyUsage, _VerifyStatus, _coercePrivateKey, _findBlockAtIndex, _getBlock, _readAlgorithmIdentifier, _readBitString, _readBooleanValue, _readDirectoryName, _readECCAlgorithmIdentifier, _readExtension, _readIntegerAsByteString, _readIntegerValue, _readListOfInteger, _readLongIntegerValue, _readObjectIdentifier, _readOctetString, _readSignatureValue, _readSignatureValueBin, _readStruct, _readTime, _readValue, _readVersionValue, certificateMatchesPrivateKey, coerceCertificate, coerceCertificatePem, coercePEMorDerToPrivateKey, coercePrivateKeyPem, coercePublicKeyPem, coerceRsaPublicKeyPem, combine_der, compactDirectoryName, computeDerivedKeys, computePaddingFooter, convertPEMtoDER, createCertificateSigningRequest, createSelfSignedCertificate, decryptBufferWithDerivedKeys, derToPrivateKey, encryptBufferWithDerivedKeys, exploreCertificate, exploreCertificateInfo, exploreCertificateRevocationList, exploreCertificateSigningRequest, explorePrivateKey, extractPublicKeyFromCertificate, extractPublicKeyFromCertificateSync, formatBuffer2DigitHexWithColum, generateKeyPair, generatePrivateKey, hexDump, identifyPemType, makeMessageChunkSignature, makeMessageChunkSignatureWithDerivedKeys, makePrivateKeyFromPem, makePseudoRandomBuffer, makeSHA1Thumbprint, parseBitString, pemToPrivateKey, privateDecrypt, privateDecrypt_long, privateDecrypt_native, privateKeyToPEM, publicEncrypt, publicEncrypt_long, publicEncrypt_native, publicKeyAndPrivateKeyMatches, readCertificationRequestInfo, readNameForCrl, readTag, readTbsCertificate, reduceLength, removePadding, removeTrailingLF, rsaLengthPrivateKey, rsaLengthPublicKey, rsaLengthRsaPublicKey, split_der, toPem, toPem2, verifyCertificateChain, verifyCertificateOrClrSignature, verifyCertificateRevocationListSignature, verifyCertificateSignature, verifyChunkSignature, verifyChunkSignatureWithDerivedKeys, verifyMessageChunkSignature } from './source/index.js';
3
- export { CertificateSigningRequest, generatePrivateKeyFile, generatePrivateKeyFileAlternate, getCertificateStore, makePrivateKeyThumbPrint, readCertificate, readCertificatePEM, readCertificateRevocationList, readCertificateSigningRequest, readPrivateKey, readPrivateKeyPEM, readPrivateRsaKey, readPublicKey, readPublicKeyPEM, readPublicRsaKey, setCertificateStore } from './source_nodejs/index.js';
4
5
  import 'crypto';
5
6
  import '@peculiar/x509';