node-opcua-crypto 4.9.3 → 4.10.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.
- package/LICENSE +23 -23
- package/README.md +114 -114
- package/dist/{chunk-VAMKYXNP.mjs → chunk-46EEAYVO.mjs} +37 -16
- package/dist/chunk-46EEAYVO.mjs.map +1 -0
- package/dist/{chunk-WYY6WVVJ.mjs → chunk-GNEWUC7X.mjs} +2 -2
- package/dist/chunk-GNEWUC7X.mjs.map +1 -0
- package/dist/chunk-VI4S2NM5.mjs +38 -0
- package/dist/chunk-VI4S2NM5.mjs.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +69 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -3
- package/dist/index_web.d.mts +2 -1
- package/dist/index_web.d.ts +2 -1
- package/dist/index_web.js +69 -19
- package/dist/index_web.js.map +1 -1
- package/dist/index_web.mjs +5 -2
- package/dist/source/index.d.mts +6 -521
- package/dist/source/index.d.ts +6 -521
- package/dist/source/index.js +69 -19
- package/dist/source/index.js.map +1 -1
- package/dist/source/index.mjs +5 -2
- package/dist/source/index_web.d.mts +528 -4
- package/dist/source/index_web.d.ts +528 -4
- package/dist/source/index_web.js +36 -15
- package/dist/source/index_web.js.map +1 -1
- package/dist/source/index_web.mjs +1 -1
- package/dist/source_nodejs/index.js +6 -6
- package/dist/source_nodejs/index.js.map +1 -1
- package/dist/source_nodejs/index.mjs +3 -3
- package/index.mjs +1 -1
- package/index_web.ts +1 -1
- package/package.json +4 -4
- package/dist/chunk-5NV4OKIV.mjs +0 -1
- package/dist/chunk-5NV4OKIV.mjs.map +0 -1
- package/dist/chunk-VAMKYXNP.mjs.map +0 -1
- package/dist/chunk-WYY6WVVJ.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) Etienne Rossignon 2015-2022
|
|
4
|
-
Copyright (c) Sterfive.com 2022-2024
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
23
|
-
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Etienne Rossignon 2015-2022
|
|
4
|
+
Copyright (c) Sterfive.com 2022-2024
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
package/README.md
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
# node-opcua-crypto
|
|
2
|
-
|
|
3
|
-
NodeOPCUA Crypto is a powerful JavaScript module for handling security and cryptography for OPCUA. It's written in TypeScript and runs smoothly on Node.js and in the browser.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmtrends.com/node-opcua-crypto)
|
|
6
|
-
[](https://www.npmjs.com/package/node-opcua-crypto?activeTab=versions)
|
|
7
|
-
[](https://github.com/node-opcua/node-opcua-crypto/actions/workflows/main.yml)
|
|
8
|
-
[](https://codeclimate.com/github/node-opcua/node-opcua-crypto)
|
|
9
|
-
[](https://coveralls.io/github/node-opcua/node-opcua-crypto?branch=master)
|
|
10
|
-
[](https://packagephobia.com/result?p=node-opcua-crypto)
|
|
11
|
-
[](https://app.fossa.com/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-crypto?ref=badge_shield)
|
|
12
|
-
<!-- [](https://codeclimate.com/github/node-opcua/node-opcua-crypto/coverage) -->
|
|
13
|
-
|
|
14
|
-
## Features
|
|
15
|
-
|
|
16
|
-
* a comprehensive set of cryptographic functionalities.
|
|
17
|
-
* supports both Node.js and browser environments.
|
|
18
|
-
* compatible with TypeScript for robust, type-safe coding.
|
|
19
|
-
* implements advanced security standards for OPCUA.
|
|
20
|
-
|
|
21
|
-
## Getting Started
|
|
22
|
-
|
|
23
|
-
To use NodeOPCUA Crypto in your project, follow these steps:
|
|
24
|
-
|
|
25
|
-
#### Installation
|
|
26
|
-
|
|
27
|
-
``` bash
|
|
28
|
-
npm install nodeopcua-crypto
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Usage
|
|
32
|
-
|
|
33
|
-
``` bash
|
|
34
|
-
|
|
35
|
-
import { generatePrivateKey, privateKeyToPEM, CertificatePurpose, createSelfSignedCertificate } from "./node-opcua-crypto.js";
|
|
36
|
-
|
|
37
|
-
async function demonstratePrivateKeyAndSelfSignedCertificateCreation() {
|
|
38
|
-
|
|
39
|
-
// create the Private Key
|
|
40
|
-
const privateKey = await generatePrivateKey();
|
|
41
|
-
|
|
42
|
-
// convert the private key to a PEM format
|
|
43
|
-
const { privPem } = await privateKeyToPEM(privateKey);
|
|
44
|
-
|
|
45
|
-
console.log(privPem);
|
|
46
|
-
|
|
47
|
-
// create a self-sign certificate
|
|
48
|
-
const { cert } = await createSelfSignedCertificate({
|
|
49
|
-
privateKey,
|
|
50
|
-
notAfter: new Date(2025, 1, 1),
|
|
51
|
-
notBefore: new Date(2019, 1, 1),
|
|
52
|
-
subject: "CN=Test",
|
|
53
|
-
dns: ["DNS1", "DNS2"],
|
|
54
|
-
ip: ["192.168.1.1"],
|
|
55
|
-
applicationUri: "urn:HOSTNAME:ServerDescription",
|
|
56
|
-
purpose: CertificatePurpose.ForApplication,
|
|
57
|
-
});
|
|
58
|
-
console.log(cert);
|
|
59
|
-
}
|
|
60
|
-
demonstratePrivateKeyAndSelfSignedCertificateCreation();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Please refer to the examples directory for more specific use cases and comprehensive samples.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
## Support
|
|
69
|
-
|
|
70
|
-
For any inquiries or issues related to NodeOPCUA Crypto, you can contact us at contact@sterfive.com. Please note that priority support is available to NodeOPCUA Support Subscription members.
|
|
71
|
-
|
|
72
|
-
### Getting professional support
|
|
73
|
-
|
|
74
|
-
NodeOPCUA PKI is developed and maintained by sterfive.com.
|
|
75
|
-
|
|
76
|
-
To get professional support, consider subscribing to the node-opcua membership community:
|
|
77
|
-
|
|
78
|
-
[](https://support.sterfive.com)
|
|
79
|
-
|
|
80
|
-
or contact [sterfive](https://www.sterfive.com) for dedicated consulting and more advanced support.
|
|
81
|
-
|
|
82
|
-
## Contributing
|
|
83
|
-
|
|
84
|
-
We appreciate contributions from the community. To contribute:
|
|
85
|
-
|
|
86
|
-
* Fork the repository.
|
|
87
|
-
* Create a new branch.
|
|
88
|
-
* Commit your changes.
|
|
89
|
-
* Submit a pull request.
|
|
90
|
-
* Sign the CLA (Contributor Licence Agreement) form
|
|
91
|
-
|
|
92
|
-
For more detailed instructions, refer to the CONTRIBUTING.md file.
|
|
93
|
-
|
|
94
|
-
## License
|
|
95
|
-
|
|
96
|
-
NodeOPCUA Crypto is MIT licensed. See the LICENSE file for full license details.
|
|
97
|
-
|
|
98
|
-
Copyright © 2023-2024 Sterfive.com.
|
|
99
|
-
|
|
100
|
-
## Disclaimer
|
|
101
|
-
|
|
102
|
-
NodeOPCUA Crypto is provided as-is, and while we strive to ensure its quality and security, Sterfive.com cannot be held liable for any damage caused directly or indirectly by the usage of this module.
|
|
103
|
-
|
|
104
|
-
Please report any issues or vulnerabilities you find via the issue tracker.
|
|
105
|
-
|
|
106
|
-
Thank you for considering NodeOPCUA Crypto for your OPCUA cryptography needs. We look forward to seeing what you build with i
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
## Supporting the development effort - Sponsors & Backers
|
|
111
|
-
|
|
112
|
-
If you like `node-opcua-pki` and if you are relying on it in one of your projects, please consider becoming a backer and [sponsoring us](https://github.com/sponsors/node-opcua), this will help us to maintain a high-quality stack and constant evolution of this module.
|
|
113
|
-
|
|
114
|
-
If your company would like to participate and influence the development of future versions of `node-opcua` please contact [sterfive](mailto:contact@sterfive.com).
|
|
1
|
+
# node-opcua-crypto
|
|
2
|
+
|
|
3
|
+
NodeOPCUA Crypto is a powerful JavaScript module for handling security and cryptography for OPCUA. It's written in TypeScript and runs smoothly on Node.js and in the browser.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmtrends.com/node-opcua-crypto)
|
|
6
|
+
[](https://www.npmjs.com/package/node-opcua-crypto?activeTab=versions)
|
|
7
|
+
[](https://github.com/node-opcua/node-opcua-crypto/actions/workflows/main.yml)
|
|
8
|
+
[](https://codeclimate.com/github/node-opcua/node-opcua-crypto)
|
|
9
|
+
[](https://coveralls.io/github/node-opcua/node-opcua-crypto?branch=master)
|
|
10
|
+
[](https://packagephobia.com/result?p=node-opcua-crypto)
|
|
11
|
+
[](https://app.fossa.com/projects/custom%2B20248%2Fgithub.com%2Fnode-opcua%2Fnode-opcua-crypto?ref=badge_shield)
|
|
12
|
+
<!-- [](https://codeclimate.com/github/node-opcua/node-opcua-crypto/coverage) -->
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
* a comprehensive set of cryptographic functionalities.
|
|
17
|
+
* supports both Node.js and browser environments.
|
|
18
|
+
* compatible with TypeScript for robust, type-safe coding.
|
|
19
|
+
* implements advanced security standards for OPCUA.
|
|
20
|
+
|
|
21
|
+
## Getting Started
|
|
22
|
+
|
|
23
|
+
To use NodeOPCUA Crypto in your project, follow these steps:
|
|
24
|
+
|
|
25
|
+
#### Installation
|
|
26
|
+
|
|
27
|
+
``` bash
|
|
28
|
+
npm install nodeopcua-crypto
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Usage
|
|
32
|
+
|
|
33
|
+
``` bash
|
|
34
|
+
|
|
35
|
+
import { generatePrivateKey, privateKeyToPEM, CertificatePurpose, createSelfSignedCertificate } from "./node-opcua-crypto.js";
|
|
36
|
+
|
|
37
|
+
async function demonstratePrivateKeyAndSelfSignedCertificateCreation() {
|
|
38
|
+
|
|
39
|
+
// create the Private Key
|
|
40
|
+
const privateKey = await generatePrivateKey();
|
|
41
|
+
|
|
42
|
+
// convert the private key to a PEM format
|
|
43
|
+
const { privPem } = await privateKeyToPEM(privateKey);
|
|
44
|
+
|
|
45
|
+
console.log(privPem);
|
|
46
|
+
|
|
47
|
+
// create a self-sign certificate
|
|
48
|
+
const { cert } = await createSelfSignedCertificate({
|
|
49
|
+
privateKey,
|
|
50
|
+
notAfter: new Date(2025, 1, 1),
|
|
51
|
+
notBefore: new Date(2019, 1, 1),
|
|
52
|
+
subject: "CN=Test",
|
|
53
|
+
dns: ["DNS1", "DNS2"],
|
|
54
|
+
ip: ["192.168.1.1"],
|
|
55
|
+
applicationUri: "urn:HOSTNAME:ServerDescription",
|
|
56
|
+
purpose: CertificatePurpose.ForApplication,
|
|
57
|
+
});
|
|
58
|
+
console.log(cert);
|
|
59
|
+
}
|
|
60
|
+
demonstratePrivateKeyAndSelfSignedCertificateCreation();
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Please refer to the examples directory for more specific use cases and comprehensive samples.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Support
|
|
69
|
+
|
|
70
|
+
For any inquiries or issues related to NodeOPCUA Crypto, you can contact us at contact@sterfive.com. Please note that priority support is available to NodeOPCUA Support Subscription members.
|
|
71
|
+
|
|
72
|
+
### Getting professional support
|
|
73
|
+
|
|
74
|
+
NodeOPCUA PKI is developed and maintained by sterfive.com.
|
|
75
|
+
|
|
76
|
+
To get professional support, consider subscribing to the node-opcua membership community:
|
|
77
|
+
|
|
78
|
+
[](https://support.sterfive.com)
|
|
79
|
+
|
|
80
|
+
or contact [sterfive](https://www.sterfive.com) for dedicated consulting and more advanced support.
|
|
81
|
+
|
|
82
|
+
## Contributing
|
|
83
|
+
|
|
84
|
+
We appreciate contributions from the community. To contribute:
|
|
85
|
+
|
|
86
|
+
* Fork the repository.
|
|
87
|
+
* Create a new branch.
|
|
88
|
+
* Commit your changes.
|
|
89
|
+
* Submit a pull request.
|
|
90
|
+
* Sign the CLA (Contributor Licence Agreement) form
|
|
91
|
+
|
|
92
|
+
For more detailed instructions, refer to the CONTRIBUTING.md file.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
NodeOPCUA Crypto is MIT licensed. See the LICENSE file for full license details.
|
|
97
|
+
|
|
98
|
+
Copyright © 2023-2024 Sterfive.com.
|
|
99
|
+
|
|
100
|
+
## Disclaimer
|
|
101
|
+
|
|
102
|
+
NodeOPCUA Crypto is provided as-is, and while we strive to ensure its quality and security, Sterfive.com cannot be held liable for any damage caused directly or indirectly by the usage of this module.
|
|
103
|
+
|
|
104
|
+
Please report any issues or vulnerabilities you find via the issue tracker.
|
|
105
|
+
|
|
106
|
+
Thank you for considering NodeOPCUA Crypto for your OPCUA cryptography needs. We look forward to seeing what you build with i
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## Supporting the development effort - Sponsors & Backers
|
|
111
|
+
|
|
112
|
+
If you like `node-opcua-pki` and if you are relying on it in one of your projects, please consider becoming a backer and [sponsoring us](https://github.com/sponsors/node-opcua), this will help us to maintain a high-quality stack and constant evolution of this module.
|
|
113
|
+
|
|
114
|
+
If your company would like to participate and influence the development of future versions of `node-opcua` please contact [sterfive](mailto:contact@sterfive.com).
|
|
@@ -102,6 +102,7 @@ var oid_map = {
|
|
|
102
102
|
"1.3.6.1.4.1.311.2.1.22": { d: "1.3.6.1.4.1.311.2.1.22", c: "SPC_COMMERCIAL_SP_KEY_PURPOSE_OBJID" },
|
|
103
103
|
"1.3.6.1.4.1.311.10.3.1": { d: "1.3.6.1.4.1.311.10.3.1", c: "Signer of CTLs -- szOID_KP_CTL_USAGE_SIGNING" },
|
|
104
104
|
"1.3.6.1.4.1.311.10.3.4": { d: "1.3.6.1.4.1.311.10.3.4", c: "szOID_EFS_RECOVERY (Encryption File System)" },
|
|
105
|
+
"1.3.6.1.4.1.311.20.2.3": { d: "1.3.6.1.4.1.311.20.2.3", c: "id-on-personalData" },
|
|
105
106
|
"1.3.6.1.5.5.7.3.17": { d: "1.3.6.1.5.5.7.3.17", c: "Internet Key Exchange (IKE)" },
|
|
106
107
|
"1.3.6.1.5.5.7.3.1": { d: "serverAuth", c: "PKIX key purpose" },
|
|
107
108
|
"1.3.6.1.5.5.7.3.2": { d: "clientAuth", c: "PKIX key purpose" },
|
|
@@ -361,12 +362,15 @@ var TagType = /* @__PURE__ */ ((TagType3) => {
|
|
|
361
362
|
TagType3[TagType3["BMPString"] = 30] = "BMPString";
|
|
362
363
|
TagType3[TagType3["SEQUENCE"] = 48] = "SEQUENCE";
|
|
363
364
|
TagType3[TagType3["SET"] = 49] = "SET";
|
|
364
|
-
TagType3[TagType3["
|
|
365
|
+
TagType3[TagType3["CONTEXT_SPECIFIC0"] = 160] = "CONTEXT_SPECIFIC0";
|
|
366
|
+
TagType3[TagType3["CONTEXT_SPECIFIC1"] = 161] = "CONTEXT_SPECIFIC1";
|
|
367
|
+
TagType3[TagType3["CONTEXT_SPECIFIC2"] = 162] = "CONTEXT_SPECIFIC2";
|
|
368
|
+
TagType3[TagType3["CONTEXT_SPECIFIC3"] = 163] = "CONTEXT_SPECIFIC3";
|
|
369
|
+
TagType3[TagType3["A4"] = 164] = "A4";
|
|
365
370
|
return TagType3;
|
|
366
371
|
})(TagType || {});
|
|
367
372
|
function readTag(buf, pos) {
|
|
368
|
-
|
|
369
|
-
assert(Number.isFinite(pos) && pos >= 0);
|
|
373
|
+
const start = pos;
|
|
370
374
|
if (buf.length <= pos) {
|
|
371
375
|
throw new Error("Invalid position : buf.length=" + buf.length + " pos =" + pos);
|
|
372
376
|
}
|
|
@@ -382,7 +386,7 @@ function readTag(buf, pos) {
|
|
|
382
386
|
pos += 1;
|
|
383
387
|
}
|
|
384
388
|
}
|
|
385
|
-
return { tag, position: pos, length };
|
|
389
|
+
return { start, tag, position: pos, length };
|
|
386
390
|
}
|
|
387
391
|
function _readStruct(buf, blockInfo) {
|
|
388
392
|
const length = blockInfo.length;
|
|
@@ -447,8 +451,8 @@ function _readIntegerAsByteString(buffer, block) {
|
|
|
447
451
|
function _readListOfInteger(buffer) {
|
|
448
452
|
const block = readTag(buffer, 0);
|
|
449
453
|
const inner_blocks = _readStruct(buffer, block);
|
|
450
|
-
return inner_blocks.map((
|
|
451
|
-
return _readIntegerAsByteString(buffer,
|
|
454
|
+
return inner_blocks.map((innerBlock) => {
|
|
455
|
+
return _readIntegerAsByteString(buffer, innerBlock);
|
|
452
456
|
});
|
|
453
457
|
}
|
|
454
458
|
function parseOID(buffer, start, end) {
|
|
@@ -914,7 +918,8 @@ function _readGeneralNames(buffer, block) {
|
|
|
914
918
|
5: { name: "ediPartyName", type: "EDIPartyName" },
|
|
915
919
|
6: { name: "uniformResourceIdentifier", type: "IA5String" },
|
|
916
920
|
7: { name: "iPAddress", type: "OCTET_STRING" },
|
|
917
|
-
8: { name: "registeredID", type: "OBJECT_IDENTIFIER" }
|
|
921
|
+
8: { name: "registeredID", type: "OBJECT_IDENTIFIER" },
|
|
922
|
+
32: { name: "otherName", type: "AnotherName" }
|
|
918
923
|
};
|
|
919
924
|
const blocks = _readStruct(buffer, block);
|
|
920
925
|
function _readFromType(buffer2, block2, type) {
|
|
@@ -931,10 +936,25 @@ function _readGeneralNames(buffer, block) {
|
|
|
931
936
|
const t = block2.tag & 127;
|
|
932
937
|
const type = _data[t];
|
|
933
938
|
if (!type) {
|
|
934
|
-
|
|
939
|
+
console.log("_readGeneralNames: INVALID TYPE => " + t + " 0x" + t.toString(16));
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
if (t == 32) {
|
|
943
|
+
n[type.name] = n[type.name] || [];
|
|
944
|
+
const blocks2 = _readStruct(buffer, block2);
|
|
945
|
+
const name = _readObjectIdentifier(buffer, blocks2[0]).name;
|
|
946
|
+
const buf = _getBlock(buffer, blocks2[1]);
|
|
947
|
+
const b = readTag(buf, 0);
|
|
948
|
+
const nn = _readValue(buf, b);
|
|
949
|
+
const data = {
|
|
950
|
+
identifier: name,
|
|
951
|
+
value: nn
|
|
952
|
+
};
|
|
953
|
+
n[type.name].push(data.value);
|
|
954
|
+
} else {
|
|
955
|
+
n[type.name] = n[type.name] || [];
|
|
956
|
+
n[type.name].push(_readFromType(buffer, block2, type.type));
|
|
935
957
|
}
|
|
936
|
-
n[type.name] = n[type.name] || [];
|
|
937
|
-
n[type.name].push(_readFromType(buffer, block2, type.type));
|
|
938
958
|
}
|
|
939
959
|
return n;
|
|
940
960
|
}
|
|
@@ -1639,19 +1659,20 @@ import * as x509 from "@peculiar/x509";
|
|
|
1639
1659
|
import { Crypto as PeculiarWebCrypto } from "@peculiar/webcrypto";
|
|
1640
1660
|
import nativeCrypto from "crypto";
|
|
1641
1661
|
import * as x5092 from "@peculiar/x509";
|
|
1662
|
+
var doDebug3 = false;
|
|
1642
1663
|
var _crypto;
|
|
1643
1664
|
var ignoreCrypto = process.env.IGNORE_SUBTLE_FROM_CRYPTO;
|
|
1644
1665
|
if (typeof window === "undefined") {
|
|
1645
1666
|
_crypto = nativeCrypto;
|
|
1646
1667
|
if (!_crypto?.subtle || ignoreCrypto) {
|
|
1647
1668
|
_crypto = new PeculiarWebCrypto();
|
|
1648
|
-
console.warn("using @peculiar/webcrypto");
|
|
1669
|
+
doDebug3 && console.warn("using @peculiar/webcrypto");
|
|
1649
1670
|
} else {
|
|
1650
|
-
console.warn("using nodejs crypto (native)");
|
|
1671
|
+
doDebug3 && console.warn("using nodejs crypto (native)");
|
|
1651
1672
|
}
|
|
1652
1673
|
x509.cryptoProvider.set(_crypto);
|
|
1653
1674
|
} else {
|
|
1654
|
-
console.warn("using browser crypto (native)");
|
|
1675
|
+
doDebug3 && console.warn("using browser crypto (native)");
|
|
1655
1676
|
_crypto = crypto;
|
|
1656
1677
|
x509.cryptoProvider.set(crypto);
|
|
1657
1678
|
}
|
|
@@ -6061,7 +6082,7 @@ async function createSelfSignedCertificate({
|
|
|
6061
6082
|
|
|
6062
6083
|
// source/x509/coerce_private_key.ts
|
|
6063
6084
|
var crypto2 = getCrypto();
|
|
6064
|
-
var
|
|
6085
|
+
var doDebug4 = false;
|
|
6065
6086
|
function coercePEMorDerToPrivateKey(privateKeyInDerOrPem) {
|
|
6066
6087
|
if (typeof privateKeyInDerOrPem === "string") {
|
|
6067
6088
|
const hidden = createPrivateKeyFromNodeJSCrypto(privateKeyInDerOrPem);
|
|
@@ -6079,7 +6100,7 @@ async function _coercePrivateKey(privateKey) {
|
|
|
6079
6100
|
const privateKey1 = await pemToPrivateKey(privateKey);
|
|
6080
6101
|
return KeyObject4.from(privateKey1);
|
|
6081
6102
|
} catch (err) {
|
|
6082
|
-
|
|
6103
|
+
doDebug4 && console.log(privateKey);
|
|
6083
6104
|
throw err;
|
|
6084
6105
|
}
|
|
6085
6106
|
} else if (privateKey instanceof KeyObject4) {
|
|
@@ -6257,4 +6278,4 @@ asn1js/build/index.es.js:
|
|
|
6257
6278
|
*
|
|
6258
6279
|
*)
|
|
6259
6280
|
*/
|
|
6260
|
-
//# sourceMappingURL=chunk-
|
|
6281
|
+
//# sourceMappingURL=chunk-46EEAYVO.mjs.map
|