node-opcua-crypto 2.1.2 → 3.0.0-beta.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/.fossa.yml +18 -18
- package/.github/FUNDING.yml +12 -12
- package/.github/workflows/main.yml +109 -106
- package/.prettierrc.js +6 -6
- package/LICENSE +23 -23
- package/README.md +14 -14
- package/_tmp_certificate.pem +20 -0
- package/_tmp_csr.pem +17 -0
- package/_tmp_privatekey.der +0 -0
- package/_tmp_privatekey.pem +28 -0
- package/dist/source/asn1.d.ts +73 -73
- package/dist/source/asn1.js +359 -359
- package/dist/source/asn1.js.map +1 -1
- package/dist/source/buffer_utils.d.ts +5 -6
- package/dist/source/buffer_utils.js +21 -21
- package/dist/source/common.d.ts +20 -14
- package/dist/source/common.js +10 -2
- package/dist/source/common.js.map +1 -1
- package/dist/source/create_key_pair.d.ts +42 -0
- package/dist/source/create_key_pair.js +136 -0
- package/dist/source/create_key_pair.js.map +1 -0
- package/dist/source/crypto_explore_certificate.d.ts +107 -107
- package/dist/source/crypto_explore_certificate.js +601 -601
- package/dist/source/crypto_utils.d.ts +76 -76
- package/dist/source/crypto_utils.js +329 -329
- package/dist/source/derived_keys.d.ts +72 -72
- package/dist/source/derived_keys.js +248 -248
- package/dist/source/explore_certificate.d.ts +30 -30
- package/dist/source/explore_certificate.js +43 -43
- package/dist/source/explore_certificate_revocation_list.d.ts +28 -28
- package/dist/source/explore_certificate_revocation_list.js +69 -69
- package/dist/source/explore_certificate_signing_request.d.ts +13 -13
- package/dist/source/explore_certificate_signing_request.js +44 -44
- package/dist/source/explore_private_key.d.ts +29 -29
- package/dist/source/explore_private_key.js +95 -97
- package/dist/source/explore_private_key.js.map +1 -1
- package/dist/source/index.d.ts +17 -13
- package/dist/source/index.js +33 -29
- package/dist/source/index.js.map +1 -1
- package/dist/source/oid_map.d.ts +7 -7
- package/dist/source/oid_map.js +303 -303
- package/dist/source/public_private_match.d.ts +3 -3
- package/dist/source/public_private_match.js +36 -36
- package/dist/source/subject.d.ts +27 -0
- package/dist/source/subject.js +125 -0
- package/dist/source/subject.js.map +1 -0
- package/dist/source/verify_certificate_signature.d.ts +10 -10
- package/dist/source/verify_certificate_signature.js +101 -101
- package/dist/source/x509/_build_public_key.d.ts +1 -0
- package/dist/source/x509/_build_public_key.js +36 -0
- package/dist/source/x509/_build_public_key.js.map +1 -0
- package/dist/source/x509/_crypto.d.ts +3 -0
- package/dist/source/x509/_crypto.js +9 -0
- package/dist/source/x509/_crypto.js.map +1 -0
- package/dist/source/x509/_fix.d.ts +2 -0
- package/dist/source/x509/_fix.js +74 -0
- package/dist/source/x509/_fix.js.map +1 -0
- package/dist/source/x509/_get_attributes.d.ts +8 -0
- package/dist/source/x509/_get_attributes.js +56 -0
- package/dist/source/x509/_get_attributes.js.map +1 -0
- package/dist/source/x509/_internals.d.ts +0 -0
- package/dist/source/x509/_internals.js +2 -0
- package/dist/source/x509/_internals.js.map +1 -0
- package/dist/source/x509/create_certificate_signing_request.d.ts +18 -0
- package/dist/source/x509/create_certificate_signing_request.js +53 -0
- package/dist/source/x509/create_certificate_signing_request.js.map +1 -0
- package/dist/source/x509/create_key_pair.d.ts +28 -0
- package/dist/source/x509/create_key_pair.js +62 -0
- package/dist/source/x509/create_key_pair.js.map +1 -0
- package/dist/source/x509/create_self_signed_certificate.d.ts +17 -0
- package/dist/source/x509/create_self_signed_certificate.js +71 -0
- package/dist/source/x509/create_self_signed_certificate.js.map +1 -0
- package/dist/source_nodejs/generate_private_key_filename.d.ts +1 -0
- package/dist/source_nodejs/generate_private_key_filename.js +25 -0
- package/dist/source_nodejs/generate_private_key_filename.js.map +1 -0
- package/dist/source_nodejs/index.d.ts +4 -3
- package/dist/source_nodejs/index.js +20 -19
- package/dist/source_nodejs/index.js.map +1 -1
- package/dist/source_nodejs/read.d.ts +23 -23
- package/dist/source_nodejs/read.js +106 -106
- package/dist/source_nodejs/read_certificate_revocation_list.d.ts +2 -2
- package/dist/source_nodejs/read_certificate_revocation_list.js +27 -27
- package/dist/source_nodejs/read_certificate_signing_request.d.ts +3 -3
- package/dist/source_nodejs/read_certificate_signing_request.js +27 -27
- package/index.d.ts +2 -2
- package/index.js +4 -4
- package/index_web.js +3 -3
- package/package.json +15 -9
- package/source/asn1.ts +404 -404
- package/source/buffer_utils.ts +18 -18
- package/source/common.ts +7 -0
- package/source/crypto_explore_certificate.ts +764 -764
- package/source/derived_keys.ts +287 -287
- package/source/explore_certificate.ts +66 -66
- package/source/explore_certificate_revocation_list.ts +122 -122
- package/source/explore_certificate_signing_request.ts +58 -58
- package/source/explore_private_key.ts +1 -2
- package/source/index.ts +17 -13
- package/source/oid_map.ts +310 -310
- package/source/subject.ts +144 -0
- package/source/verify_certificate_signature.ts +105 -105
- package/source/x509/_build_public_key.ts +25 -0
- package/source/x509/_crypto.ts +5 -0
- package/source/x509/_get_attributes.ts +60 -0
- package/source/x509/create_certificate_signing_request.ts +64 -0
- package/source/x509/create_key_pair.ts +70 -0
- package/source/x509/create_self_signed_certificate.ts +91 -0
- package/source_nodejs/generate_private_key_filename.ts +10 -0
- package/source_nodejs/index.ts +4 -3
- package/source_nodejs/read_certificate_revocation_list.ts +14 -14
- package/source_nodejs/read_certificate_signing_request.ts +17 -17
- package/test_certificate.ts +34 -34
- package/tsconfig.json +19 -18
- package/tslint.json +34 -34
- package/dist/source/certificate_matches_private_key.d.ts +0 -2
- package/dist/source/certificate_matches_private_key.js +0 -22
- package/dist/source/certificate_matches_private_key.js.map +0 -1
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readPublicRsaKey = exports.readPrivateRsaKey = exports.setCertificateStore = exports.readPrivateKeyPEM = exports.readPublicKeyPEM = exports.readCertificatePEM = exports.readPrivateKey = exports.readPublicKey = exports.readCertificate = void 0;
|
|
4
|
-
const assert = require("assert");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const crypto_1 = require("crypto");
|
|
8
|
-
const crypto_utils_1 = require("../source/crypto_utils");
|
|
9
|
-
const sshpk = require("sshpk");
|
|
10
|
-
function _readPemFile(filename) {
|
|
11
|
-
assert(typeof filename === "string");
|
|
12
|
-
return fs.readFileSync(filename, "ascii");
|
|
13
|
-
}
|
|
14
|
-
function _readPemOrDerFileAsDER(filename) {
|
|
15
|
-
if (filename.match(/.*\.der/)) {
|
|
16
|
-
return fs.readFileSync(filename);
|
|
17
|
-
}
|
|
18
|
-
const raw_key = _readPemFile(filename);
|
|
19
|
-
return (0, crypto_utils_1.convertPEMtoDER)(raw_key);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* read a DER or PEM certificate from file
|
|
23
|
-
*/
|
|
24
|
-
function readCertificate(filename) {
|
|
25
|
-
return _readPemOrDerFileAsDER(filename);
|
|
26
|
-
}
|
|
27
|
-
exports.readCertificate = readCertificate;
|
|
28
|
-
/**
|
|
29
|
-
* read a DER or PEM certificate from file
|
|
30
|
-
*/
|
|
31
|
-
function readPublicKey(filename) {
|
|
32
|
-
if (filename.match(/.*\.der/)) {
|
|
33
|
-
const der = fs.readFileSync(filename);
|
|
34
|
-
return (0, crypto_1.createPublicKey)(der);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
const raw_key = _readPemFile(filename);
|
|
38
|
-
return (0, crypto_1.createPublicKey)(raw_key);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.readPublicKey = readPublicKey;
|
|
42
|
-
function myCreatePrivateKey(rawKey) {
|
|
43
|
-
// see https://askubuntu.com/questions/1409458/openssl-config-cuases-error-in-node-js-crypto-how-should-the-config-be-updated
|
|
44
|
-
const backup = process.env.OPENSSL_CONF;
|
|
45
|
-
process.env.OPENSSL_CONF = "/dev/null";
|
|
46
|
-
const retValue = (0, crypto_1.createPrivateKey)(rawKey);
|
|
47
|
-
process.env.OPENSSL_CONF = backup;
|
|
48
|
-
return retValue;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* read a DER or PEM certificate from file
|
|
52
|
-
*/
|
|
53
|
-
function readPrivateKey(filename) {
|
|
54
|
-
if (filename.match(/.*\.der/)) {
|
|
55
|
-
const der = fs.readFileSync(filename);
|
|
56
|
-
return myCreatePrivateKey(der);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
const raw_key = _readPemFile(filename);
|
|
60
|
-
return myCreatePrivateKey(raw_key);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.readPrivateKey = readPrivateKey;
|
|
64
|
-
function readCertificatePEM(filename) {
|
|
65
|
-
return _readPemFile(filename);
|
|
66
|
-
}
|
|
67
|
-
exports.readCertificatePEM = readCertificatePEM;
|
|
68
|
-
function readPublicKeyPEM(filename) {
|
|
69
|
-
return _readPemFile(filename);
|
|
70
|
-
}
|
|
71
|
-
exports.readPublicKeyPEM = readPublicKeyPEM;
|
|
72
|
-
function readPrivateKeyPEM(filename) {
|
|
73
|
-
return _readPemFile(filename);
|
|
74
|
-
}
|
|
75
|
-
exports.readPrivateKeyPEM = readPrivateKeyPEM;
|
|
76
|
-
let __certificate_store = path.join(__dirname, "../../certificates/");
|
|
77
|
-
function setCertificateStore(store) {
|
|
78
|
-
const old_store = __certificate_store;
|
|
79
|
-
__certificate_store = store;
|
|
80
|
-
return old_store;
|
|
81
|
-
}
|
|
82
|
-
exports.setCertificateStore = setCertificateStore;
|
|
83
|
-
/**
|
|
84
|
-
*
|
|
85
|
-
* @param filename
|
|
86
|
-
*/
|
|
87
|
-
function readPrivateRsaKey(filename) {
|
|
88
|
-
if (filename.substring(0, 1) !== "." && !fs.existsSync(filename)) {
|
|
89
|
-
filename = __certificate_store + filename;
|
|
90
|
-
}
|
|
91
|
-
const content = fs.readFileSync(filename, "ascii");
|
|
92
|
-
const sshKey = sshpk.parsePrivateKey(content, "auto");
|
|
93
|
-
const key = sshKey.toString("pkcs1");
|
|
94
|
-
return (0, crypto_1.createPrivateKey)({ format: "pem", type: "pkcs1", key });
|
|
95
|
-
}
|
|
96
|
-
exports.readPrivateRsaKey = readPrivateRsaKey;
|
|
97
|
-
function readPublicRsaKey(filename) {
|
|
98
|
-
if (filename.substring(0, 1) !== "." && !fs.existsSync(filename)) {
|
|
99
|
-
filename = __certificate_store + filename;
|
|
100
|
-
}
|
|
101
|
-
const content = fs.readFileSync(filename, "ascii");
|
|
102
|
-
const sshKey = sshpk.parseKey(content, "ssh");
|
|
103
|
-
const key = sshKey.toString("pkcs1");
|
|
104
|
-
return (0, crypto_1.createPublicKey)({ format: "pem", type: "pkcs1", key });
|
|
105
|
-
}
|
|
106
|
-
exports.readPublicRsaKey = readPublicRsaKey;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readPublicRsaKey = exports.readPrivateRsaKey = exports.setCertificateStore = exports.readPrivateKeyPEM = exports.readPublicKeyPEM = exports.readCertificatePEM = exports.readPrivateKey = exports.readPublicKey = exports.readCertificate = void 0;
|
|
4
|
+
const assert = require("assert");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const crypto_utils_1 = require("../source/crypto_utils");
|
|
9
|
+
const sshpk = require("sshpk");
|
|
10
|
+
function _readPemFile(filename) {
|
|
11
|
+
assert(typeof filename === "string");
|
|
12
|
+
return fs.readFileSync(filename, "ascii");
|
|
13
|
+
}
|
|
14
|
+
function _readPemOrDerFileAsDER(filename) {
|
|
15
|
+
if (filename.match(/.*\.der/)) {
|
|
16
|
+
return fs.readFileSync(filename);
|
|
17
|
+
}
|
|
18
|
+
const raw_key = _readPemFile(filename);
|
|
19
|
+
return (0, crypto_utils_1.convertPEMtoDER)(raw_key);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* read a DER or PEM certificate from file
|
|
23
|
+
*/
|
|
24
|
+
function readCertificate(filename) {
|
|
25
|
+
return _readPemOrDerFileAsDER(filename);
|
|
26
|
+
}
|
|
27
|
+
exports.readCertificate = readCertificate;
|
|
28
|
+
/**
|
|
29
|
+
* read a DER or PEM certificate from file
|
|
30
|
+
*/
|
|
31
|
+
function readPublicKey(filename) {
|
|
32
|
+
if (filename.match(/.*\.der/)) {
|
|
33
|
+
const der = fs.readFileSync(filename);
|
|
34
|
+
return (0, crypto_1.createPublicKey)(der);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const raw_key = _readPemFile(filename);
|
|
38
|
+
return (0, crypto_1.createPublicKey)(raw_key);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.readPublicKey = readPublicKey;
|
|
42
|
+
function myCreatePrivateKey(rawKey) {
|
|
43
|
+
// see https://askubuntu.com/questions/1409458/openssl-config-cuases-error-in-node-js-crypto-how-should-the-config-be-updated
|
|
44
|
+
const backup = process.env.OPENSSL_CONF;
|
|
45
|
+
process.env.OPENSSL_CONF = "/dev/null";
|
|
46
|
+
const retValue = (0, crypto_1.createPrivateKey)(rawKey);
|
|
47
|
+
process.env.OPENSSL_CONF = backup;
|
|
48
|
+
return retValue;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* read a DER or PEM certificate from file
|
|
52
|
+
*/
|
|
53
|
+
function readPrivateKey(filename) {
|
|
54
|
+
if (filename.match(/.*\.der/)) {
|
|
55
|
+
const der = fs.readFileSync(filename);
|
|
56
|
+
return myCreatePrivateKey(der);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const raw_key = _readPemFile(filename);
|
|
60
|
+
return myCreatePrivateKey(raw_key);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.readPrivateKey = readPrivateKey;
|
|
64
|
+
function readCertificatePEM(filename) {
|
|
65
|
+
return _readPemFile(filename);
|
|
66
|
+
}
|
|
67
|
+
exports.readCertificatePEM = readCertificatePEM;
|
|
68
|
+
function readPublicKeyPEM(filename) {
|
|
69
|
+
return _readPemFile(filename);
|
|
70
|
+
}
|
|
71
|
+
exports.readPublicKeyPEM = readPublicKeyPEM;
|
|
72
|
+
function readPrivateKeyPEM(filename) {
|
|
73
|
+
return _readPemFile(filename);
|
|
74
|
+
}
|
|
75
|
+
exports.readPrivateKeyPEM = readPrivateKeyPEM;
|
|
76
|
+
let __certificate_store = path.join(__dirname, "../../certificates/");
|
|
77
|
+
function setCertificateStore(store) {
|
|
78
|
+
const old_store = __certificate_store;
|
|
79
|
+
__certificate_store = store;
|
|
80
|
+
return old_store;
|
|
81
|
+
}
|
|
82
|
+
exports.setCertificateStore = setCertificateStore;
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param filename
|
|
86
|
+
*/
|
|
87
|
+
function readPrivateRsaKey(filename) {
|
|
88
|
+
if (filename.substring(0, 1) !== "." && !fs.existsSync(filename)) {
|
|
89
|
+
filename = __certificate_store + filename;
|
|
90
|
+
}
|
|
91
|
+
const content = fs.readFileSync(filename, "ascii");
|
|
92
|
+
const sshKey = sshpk.parsePrivateKey(content, "auto");
|
|
93
|
+
const key = sshKey.toString("pkcs1");
|
|
94
|
+
return (0, crypto_1.createPrivateKey)({ format: "pem", type: "pkcs1", key });
|
|
95
|
+
}
|
|
96
|
+
exports.readPrivateRsaKey = readPrivateRsaKey;
|
|
97
|
+
function readPublicRsaKey(filename) {
|
|
98
|
+
if (filename.substring(0, 1) !== "." && !fs.existsSync(filename)) {
|
|
99
|
+
filename = __certificate_store + filename;
|
|
100
|
+
}
|
|
101
|
+
const content = fs.readFileSync(filename, "ascii");
|
|
102
|
+
const sshKey = sshpk.parseKey(content, "ssh");
|
|
103
|
+
const key = sshKey.toString("pkcs1");
|
|
104
|
+
return (0, crypto_1.createPublicKey)({ format: "pem", type: "pkcs1", key });
|
|
105
|
+
}
|
|
106
|
+
exports.readPublicRsaKey = readPublicRsaKey;
|
|
107
107
|
//# sourceMappingURL=read.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CertificateRevocationList } from "../source/common";
|
|
2
|
-
export declare function readCertificateRevocationList(filename: string): Promise<CertificateRevocationList>;
|
|
1
|
+
import { CertificateRevocationList } from "../source/common";
|
|
2
|
+
export declare function readCertificateRevocationList(filename: string): Promise<CertificateRevocationList>;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.readCertificateRevocationList = void 0;
|
|
13
|
-
const fs = require("fs");
|
|
14
|
-
const util_1 = require("util");
|
|
15
|
-
const crypto_utils_1 = require("../source/crypto_utils");
|
|
16
|
-
function readCertificateRevocationList(filename) {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const crl = yield (0, util_1.promisify)(fs.readFile)(filename);
|
|
19
|
-
if (crl[0] === 0x30 && crl[1] === 0x82) {
|
|
20
|
-
// der format
|
|
21
|
-
return crl;
|
|
22
|
-
}
|
|
23
|
-
const raw_crl = crl.toString();
|
|
24
|
-
return (0, crypto_utils_1.convertPEMtoDER)(raw_crl);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.readCertificateRevocationList = readCertificateRevocationList;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.readCertificateRevocationList = void 0;
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const util_1 = require("util");
|
|
15
|
+
const crypto_utils_1 = require("../source/crypto_utils");
|
|
16
|
+
function readCertificateRevocationList(filename) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const crl = yield (0, util_1.promisify)(fs.readFile)(filename);
|
|
19
|
+
if (crl[0] === 0x30 && crl[1] === 0x82) {
|
|
20
|
+
// der format
|
|
21
|
+
return crl;
|
|
22
|
+
}
|
|
23
|
+
const raw_crl = crl.toString();
|
|
24
|
+
return (0, crypto_utils_1.convertPEMtoDER)(raw_crl);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.readCertificateRevocationList = readCertificateRevocationList;
|
|
28
28
|
//# sourceMappingURL=read_certificate_revocation_list.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export type CertificateSigningRequest = Buffer;
|
|
3
|
-
export declare function readCertificateSigningRequest(filename: string): Promise<CertificateSigningRequest>;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export type CertificateSigningRequest = Buffer;
|
|
3
|
+
export declare function readCertificateSigningRequest(filename: string): Promise<CertificateSigningRequest>;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.readCertificateSigningRequest = void 0;
|
|
13
|
-
const fs = require("fs");
|
|
14
|
-
const util_1 = require("util");
|
|
15
|
-
const crypto_utils_1 = require("../source/crypto_utils");
|
|
16
|
-
function readCertificateSigningRequest(filename) {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const csr = yield (0, util_1.promisify)(fs.readFile)(filename);
|
|
19
|
-
if (csr[0] === 0x30 && csr[1] === 0x82) {
|
|
20
|
-
// der format
|
|
21
|
-
return csr;
|
|
22
|
-
}
|
|
23
|
-
const raw_crl = csr.toString();
|
|
24
|
-
return (0, crypto_utils_1.convertPEMtoDER)(raw_crl);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.readCertificateSigningRequest = readCertificateSigningRequest;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.readCertificateSigningRequest = void 0;
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const util_1 = require("util");
|
|
15
|
+
const crypto_utils_1 = require("../source/crypto_utils");
|
|
16
|
+
function readCertificateSigningRequest(filename) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const csr = yield (0, util_1.promisify)(fs.readFile)(filename);
|
|
19
|
+
if (csr[0] === 0x30 && csr[1] === 0x82) {
|
|
20
|
+
// der format
|
|
21
|
+
return csr;
|
|
22
|
+
}
|
|
23
|
+
const raw_crl = csr.toString();
|
|
24
|
+
return (0, crypto_utils_1.convertPEMtoDER)(raw_crl);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.readCertificateSigningRequest = readCertificateSigningRequest;
|
|
28
28
|
//# sourceMappingURL=read_certificate_signing_request.js.map
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./dist/source";
|
|
2
|
-
export * from "./dist/source_nodejs";
|
|
1
|
+
export * from "./dist/source";
|
|
2
|
+
export * from "./dist/source_nodejs";
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
...require("./dist/source"),
|
|
3
|
-
...require("./dist/source_nodejs"),
|
|
4
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
...require("./dist/source"),
|
|
3
|
+
...require("./dist/source_nodejs"),
|
|
4
|
+
};
|
package/index_web.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
...require("./dist/source"),
|
|
3
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
...require("./dist/source"),
|
|
3
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-crypto",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"description": "Crypto tools for Node-OPCUA",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -27,28 +27,34 @@
|
|
|
27
27
|
],
|
|
28
28
|
"author": "Etienne Rossignon",
|
|
29
29
|
"license": "MIT",
|
|
30
|
+
"engine": {
|
|
31
|
+
"node": ">15.0"
|
|
32
|
+
},
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@types/mocha": "^10.0.1",
|
|
32
|
-
"@types/node": "^
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
34
|
-
"@typescript-eslint/parser": "^5.
|
|
35
|
-
"eslint": "^8.
|
|
36
|
-
"eslint-config-prettier": "^8.
|
|
35
|
+
"@types/node": "^20.1.4",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
|
37
|
+
"@typescript-eslint/parser": "^5.59.5",
|
|
38
|
+
"eslint": "^8.40.0",
|
|
39
|
+
"eslint-config-prettier": "^8.8.0",
|
|
37
40
|
"eslint-plugin-prettier": "^4.2.1",
|
|
38
41
|
"lorem-ipsum": "^2.0.8",
|
|
39
42
|
"mocha": "^10.2.0",
|
|
40
|
-
"prettier": "^2.8.
|
|
43
|
+
"prettier": "^2.8.8",
|
|
41
44
|
"should": "^13.2.3",
|
|
42
45
|
"source-map": "^0.7.4",
|
|
43
46
|
"source-map-support": "^0.5.21",
|
|
44
47
|
"ts-node": "^10.9.1",
|
|
45
|
-
"typescript": "^
|
|
48
|
+
"typescript": "^5.0.4"
|
|
46
49
|
},
|
|
47
50
|
"dependencies": {
|
|
51
|
+
"@peculiar/webcrypto": "^1.4.3",
|
|
52
|
+
"@peculiar/x509": "^1.9.3",
|
|
53
|
+
"@types/jsrsasign": "^10.5.8",
|
|
48
54
|
"better-assert": "^1.0.2",
|
|
49
55
|
"chalk": "^4.1.2",
|
|
50
56
|
"hexy": "0.3.4",
|
|
51
|
-
"jsrsasign": "^10.6
|
|
57
|
+
"jsrsasign": "^10.8.6",
|
|
52
58
|
"sshpk": "^1.17.0"
|
|
53
59
|
},
|
|
54
60
|
"repository": {
|