node-opcua-pki 4.9.0 → 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.
- package/LICENSE +22 -22
- package/bin/crypto_create_CA.js +0 -0
- package/bin/crypto_create_CA_config.example.js +18 -18
- package/bin/install_prerequisite.js +9 -9
- package/dist/lib/ca/crypto_create_CA.js +1 -2
- package/dist/lib/misc/applicationurn.js +1 -2
- package/dist/lib/misc/hostname.js +5 -6
- package/dist/lib/pki/certificate_manager.d.ts +0 -1
- package/dist/lib/pki/certificate_manager.js +8 -8
- package/dist/lib/toolbox/common.js +3 -4
- package/dist/lib/toolbox/common2.js +3 -4
- package/dist/lib/toolbox/debug.js +3 -3
- package/dist/lib/toolbox/display.js +4 -5
- package/dist/lib/toolbox/with_openssl/_create_random_file.js +3 -4
- package/dist/lib/toolbox/with_openssl/_env.js +6 -6
- package/dist/lib/toolbox/with_openssl/create_certificate_signing_request.js +2 -2
- package/dist/lib/toolbox/with_openssl/create_private_key.js +1 -2
- package/dist/lib/toolbox/with_openssl/create_self_signed_certificate.js +1 -2
- package/dist/lib/toolbox/with_openssl/execute_openssl.js +6 -7
- package/dist/lib/toolbox/with_openssl/install_prerequisite.js +3 -4
- package/dist/lib/toolbox/with_openssl/toolbox.js +7 -8
- package/dist/lib/toolbox/without_openssl/create_certificate_signing_request.js +2 -3
- package/dist/lib/toolbox/without_openssl/create_private_key.js +1 -2
- package/dist/lib/toolbox/without_openssl/create_self_signed_certificate.js +2 -3
- package/package.json +83 -85
- package/readme.md +226 -226
package/LICENSE
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2014-2022 - Etienne Rossignon - etienne.rossignon (at) gadz.org
|
|
4
|
-
Copyright (c) 2022-2024 - Sterfive.com
|
|
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.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2022 - Etienne Rossignon - etienne.rossignon (at) gadz.org
|
|
4
|
+
Copyright (c) 2022-2024 - Sterfive.com
|
|
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.
|
package/bin/crypto_create_CA.js
CHANGED
|
File without changes
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ---------------------------------------------------------------------------------------------------------------------
|
|
3
|
-
module.exports = {
|
|
4
|
-
|
|
5
|
-
subject: {
|
|
6
|
-
commonName: "NodeOPCUA-TEST",
|
|
7
|
-
organization: "NodeOPCUA",
|
|
8
|
-
organizationalUnit: "Unit",
|
|
9
|
-
locality: "Paris",
|
|
10
|
-
state: "IDF",
|
|
11
|
-
country: "FR" // Two letters
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
validity: 365 * 15, // 15 years
|
|
15
|
-
|
|
16
|
-
keySize: 2048 // default private key size : 2048, 3072 or 4096 (avoid 1024 too weak)
|
|
17
|
-
};
|
|
18
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
3
|
+
module.exports = {
|
|
4
|
+
|
|
5
|
+
subject: {
|
|
6
|
+
commonName: "NodeOPCUA-TEST",
|
|
7
|
+
organization: "NodeOPCUA",
|
|
8
|
+
organizationalUnit: "Unit",
|
|
9
|
+
locality: "Paris",
|
|
10
|
+
state: "IDF",
|
|
11
|
+
country: "FR" // Two letters
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
validity: 365 * 15, // 15 years
|
|
15
|
+
|
|
16
|
+
keySize: 2048 // default private key size : 2048, 3072 or 4096 (avoid 1024 too weak)
|
|
17
|
+
};
|
|
18
|
+
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
4
|
-
const install_prerequisite = require("../dist/lib/misc/install_prerequisite").install_prerequisite;
|
|
5
|
-
install_prerequisite(function(err){
|
|
6
|
-
if (err) {
|
|
7
|
-
console.log("err = ",err.message);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
4
|
+
const install_prerequisite = require("../dist/lib/misc/install_prerequisite").install_prerequisite;
|
|
5
|
+
install_prerequisite(function(err){
|
|
6
|
+
if (err) {
|
|
7
|
+
console.log("err = ",err.message);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
@@ -40,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
41
|
};
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.main =
|
|
43
|
+
exports.main = main;
|
|
44
44
|
const assert_1 = __importDefault(require("assert"));
|
|
45
45
|
const chalk_1 = __importDefault(require("chalk"));
|
|
46
46
|
const rimraf_1 = __importDefault(require("rimraf"));
|
|
@@ -899,5 +899,4 @@ function main(argumentsList, _done) {
|
|
|
899
899
|
}
|
|
900
900
|
});
|
|
901
901
|
}
|
|
902
|
-
exports.main = main;
|
|
903
902
|
//# sourceMappingURL=crypto_create_CA.js.map
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.makeApplicationUrn =
|
|
6
|
+
exports.makeApplicationUrn = makeApplicationUrn;
|
|
7
7
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
8
8
|
// node-opcua-pki
|
|
9
9
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -43,5 +43,4 @@ function makeApplicationUrn(hostname, suffix) {
|
|
|
43
43
|
(0, assert_1.default)(applicationUrn.length <= 64);
|
|
44
44
|
return applicationUrn;
|
|
45
45
|
}
|
|
46
|
-
exports.makeApplicationUrn = makeApplicationUrn;
|
|
47
46
|
//# sourceMappingURL=applicationurn.js.map
|
|
@@ -12,7 +12,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.extractFullyQualifiedDomainName = extractFullyQualifiedDomainName;
|
|
16
|
+
exports.prepareFQDN = prepareFQDN;
|
|
17
|
+
exports.getFullyQualifiedDomainName = getFullyQualifiedDomainName;
|
|
18
|
+
exports.getHostname = getHostname;
|
|
19
|
+
exports.resolveFullyQualifiedDomainName = resolveFullyQualifiedDomainName;
|
|
16
20
|
/**
|
|
17
21
|
* @module node-opcua-hostname
|
|
18
22
|
*/
|
|
@@ -73,24 +77,20 @@ function extractFullyQualifiedDomainName() {
|
|
|
73
77
|
return _fullyQualifiedDomainNameInCache;
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
|
-
exports.extractFullyQualifiedDomainName = extractFullyQualifiedDomainName;
|
|
77
80
|
function prepareFQDN() {
|
|
78
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
82
|
_fullyQualifiedDomainNameInCache = yield extractFullyQualifiedDomainName();
|
|
80
83
|
});
|
|
81
84
|
}
|
|
82
|
-
exports.prepareFQDN = prepareFQDN;
|
|
83
85
|
function getFullyQualifiedDomainName(optional_max_length) {
|
|
84
86
|
if (!_fullyQualifiedDomainNameInCache) {
|
|
85
87
|
throw new Error("FullyQualifiedDomainName computation is not completed yet");
|
|
86
88
|
}
|
|
87
89
|
return _fullyQualifiedDomainNameInCache ? trim(_fullyQualifiedDomainNameInCache, optional_max_length) : "%FQDN%";
|
|
88
90
|
}
|
|
89
|
-
exports.getFullyQualifiedDomainName = getFullyQualifiedDomainName;
|
|
90
91
|
function getHostname() {
|
|
91
92
|
return os_1.default.hostname();
|
|
92
93
|
}
|
|
93
|
-
exports.getHostname = getHostname;
|
|
94
94
|
function resolveFullyQualifiedDomainName(str) {
|
|
95
95
|
if (!_fullyQualifiedDomainNameInCache) {
|
|
96
96
|
throw new Error("FullyQualifiedDomainName computation is not completed yet");
|
|
@@ -100,7 +100,6 @@ function resolveFullyQualifiedDomainName(str) {
|
|
|
100
100
|
str = str.replace("{hostname}", getHostname());
|
|
101
101
|
return str;
|
|
102
102
|
}
|
|
103
|
-
exports.resolveFullyQualifiedDomainName = resolveFullyQualifiedDomainName;
|
|
104
103
|
// note : under windows ... echo %COMPUTERNAME%.%USERDNSDOMAIN%
|
|
105
104
|
prepareFQDN();
|
|
106
105
|
//# sourceMappingURL=hostname.js.map
|
|
@@ -37,7 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.CertificateManager = exports.CertificateManagerState = exports.
|
|
40
|
+
exports.CertificateManager = exports.CertificateManagerState = exports.VerificationStatus = void 0;
|
|
41
|
+
exports.findIssuerCertificateInChain = findIssuerCertificateInChain;
|
|
41
42
|
const assert_1 = __importDefault(require("assert"));
|
|
42
43
|
const async_1 = __importDefault(require("async"));
|
|
43
44
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -165,7 +166,6 @@ function findIssuerCertificateInChain(certificate, chain) {
|
|
|
165
166
|
}
|
|
166
167
|
return null;
|
|
167
168
|
}
|
|
168
|
-
exports.findIssuerCertificateInChain = findIssuerCertificateInChain;
|
|
169
169
|
var CertificateManagerState;
|
|
170
170
|
(function (CertificateManagerState) {
|
|
171
171
|
CertificateManagerState[CertificateManagerState["Uninitialized"] = 0] = "Uninitialized";
|
|
@@ -274,8 +274,8 @@ class CertificateManager {
|
|
|
274
274
|
return path_1.default.join(this.rootDir, "issuers/crl");
|
|
275
275
|
}
|
|
276
276
|
isCertificateTrusted(certificate) {
|
|
277
|
-
var _a;
|
|
278
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
+
var _a;
|
|
279
279
|
const fingerprint = makeFingerprint(certificate);
|
|
280
280
|
const certificateInTrust = (_a = this._thumbs.trusted[fingerprint]) === null || _a === void 0 ? void 0 : _a.certificate;
|
|
281
281
|
if (certificateInTrust) {
|
|
@@ -305,8 +305,8 @@ class CertificateManager {
|
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
_innerVerifyCertificateAsync(certificate, isIssuer, level, options) {
|
|
308
|
-
var _a, _b, _c, _d, _e;
|
|
309
308
|
return __awaiter(this, void 0, void 0, function* () {
|
|
309
|
+
var _a, _b, _c, _d, _e;
|
|
310
310
|
if (level >= 5) {
|
|
311
311
|
// maximum level of certificate in chain reached !
|
|
312
312
|
return VerificationStatus.BadSecurityChecksFailed;
|
|
@@ -624,8 +624,8 @@ class CertificateManager {
|
|
|
624
624
|
});
|
|
625
625
|
}, callback);
|
|
626
626
|
}
|
|
627
|
-
addIssuer(
|
|
628
|
-
return __awaiter(this,
|
|
627
|
+
addIssuer(certificate_1) {
|
|
628
|
+
return __awaiter(this, arguments, void 0, function* (certificate, validate = false, addInTrustList = false) {
|
|
629
629
|
if (validate) {
|
|
630
630
|
const status = yield this.verifyCertificate(certificate);
|
|
631
631
|
if (status !== VerificationStatus.Good && status !== VerificationStatus.BadCertificateUntrusted) {
|
|
@@ -688,8 +688,8 @@ class CertificateManager {
|
|
|
688
688
|
*
|
|
689
689
|
*/
|
|
690
690
|
findIssuerCertificate(certificate) {
|
|
691
|
-
var _a, _b;
|
|
692
691
|
return __awaiter(this, void 0, void 0, function* () {
|
|
692
|
+
var _a, _b;
|
|
693
693
|
const certInfo = (0, node_opcua_crypto_1.exploreCertificate)(certificate);
|
|
694
694
|
// istanbul ignore next
|
|
695
695
|
if (isSelfSigned2(certInfo)) {
|
|
@@ -797,8 +797,8 @@ class CertificateManager {
|
|
|
797
797
|
return this._thumbs.issuersCrl[key] ? this._thumbs.issuersCrl[key] : this._thumbs.crl[key] ? this._thumbs.crl[key] : null;
|
|
798
798
|
}
|
|
799
799
|
isCertificateRevoked(certificate, issuerCertificate) {
|
|
800
|
-
var _a, _b, _c, _d;
|
|
801
800
|
return __awaiter(this, void 0, void 0, function* () {
|
|
801
|
+
var _a, _b, _c, _d;
|
|
802
802
|
// istanbul ignore next
|
|
803
803
|
if (isSelfSigned3(certificate)) {
|
|
804
804
|
return VerificationStatus.Good;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.quote = quote;
|
|
4
|
+
exports.adjustDate = adjustDate;
|
|
5
|
+
exports.adjustApplicationUri = adjustApplicationUri;
|
|
4
6
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
5
7
|
// node-opcua-pki
|
|
6
8
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -27,7 +29,6 @@ const assert = require("assert");
|
|
|
27
29
|
function quote(str) {
|
|
28
30
|
return '"' + (str || "") + '"';
|
|
29
31
|
}
|
|
30
|
-
exports.quote = quote;
|
|
31
32
|
function adjustDate(params) {
|
|
32
33
|
assert(params instanceof Object);
|
|
33
34
|
params.startDate = params.startDate || new Date();
|
|
@@ -45,12 +46,10 @@ function adjustDate(params) {
|
|
|
45
46
|
// warningLog(" end Date ", params.endDate.toUTCString(), x509Date(params.endDate));
|
|
46
47
|
// }
|
|
47
48
|
}
|
|
48
|
-
exports.adjustDate = adjustDate;
|
|
49
49
|
function adjustApplicationUri(params) {
|
|
50
50
|
const applicationUri = params.applicationUri || "";
|
|
51
51
|
if (applicationUri.length > 200) {
|
|
52
52
|
throw new Error("Openssl doesn't support urn with length greater than 200" + applicationUri);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
exports.adjustApplicationUri = adjustApplicationUri;
|
|
56
55
|
//# sourceMappingURL=common.js.map
|
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.certificateFileExist = certificateFileExist;
|
|
7
|
+
exports.mkdir = mkdir;
|
|
8
|
+
exports.make_path = make_path;
|
|
7
9
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
8
10
|
// node-opcua-pki
|
|
9
11
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -40,7 +42,6 @@ function certificateFileExist(certificateFile) {
|
|
|
40
42
|
}
|
|
41
43
|
return true;
|
|
42
44
|
}
|
|
43
|
-
exports.certificateFileExist = certificateFileExist;
|
|
44
45
|
function mkdir(folder) {
|
|
45
46
|
if (!fs_1.default.existsSync(folder)) {
|
|
46
47
|
// istanbul ignore next
|
|
@@ -48,7 +49,6 @@ function mkdir(folder) {
|
|
|
48
49
|
fs_1.default.mkdirSync(folder);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
exports.mkdir = mkdir;
|
|
52
52
|
function make_path(folderName, filename) {
|
|
53
53
|
let s;
|
|
54
54
|
if (filename) {
|
|
@@ -61,5 +61,4 @@ function make_path(folderName, filename) {
|
|
|
61
61
|
s = s.replace(/\\/g, "/");
|
|
62
62
|
return s;
|
|
63
63
|
}
|
|
64
|
-
exports.make_path = make_path;
|
|
65
64
|
//# sourceMappingURL=common2.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.displayDebug = exports.displayError = exports.doDebug = void 0;
|
|
4
|
+
exports.debugLog = debugLog;
|
|
5
|
+
exports.warningLog = warningLog;
|
|
4
6
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
5
7
|
// node-opcua-pki
|
|
6
8
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -33,9 +35,7 @@ function debugLog(...args) {
|
|
|
33
35
|
console.log.apply(null, args);
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
|
-
exports.debugLog = debugLog;
|
|
37
38
|
function warningLog(...args) {
|
|
38
39
|
console.log.apply(null, args);
|
|
39
40
|
}
|
|
40
|
-
exports.warningLog = warningLog;
|
|
41
41
|
//# sourceMappingURL=debug.js.map
|
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.displayChapter = displayChapter;
|
|
7
|
+
exports.displayTitle = displayTitle;
|
|
8
|
+
exports.displaySubtitle = displaySubtitle;
|
|
9
|
+
exports.display = display;
|
|
7
10
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
8
11
|
// node-opcua-pki
|
|
9
12
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -40,7 +43,6 @@ function displayChapter(str, callback) {
|
|
|
40
43
|
callback();
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
|
-
exports.displayChapter = displayChapter;
|
|
44
46
|
function displayTitle(str, callback) {
|
|
45
47
|
// istanbul ignore next
|
|
46
48
|
if (!config_1.g_config.silent) {
|
|
@@ -52,7 +54,6 @@ function displayTitle(str, callback) {
|
|
|
52
54
|
callback();
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
|
-
exports.displayTitle = displayTitle;
|
|
56
57
|
function displaySubtitle(str, callback) {
|
|
57
58
|
// istanbul ignore next
|
|
58
59
|
if (!config_1.g_config.silent) {
|
|
@@ -64,7 +65,6 @@ function displaySubtitle(str, callback) {
|
|
|
64
65
|
callback();
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
exports.displaySubtitle = displaySubtitle;
|
|
68
68
|
function display(str, callback) {
|
|
69
69
|
// istanbul ignore next
|
|
70
70
|
if (!config_1.g_config.silent) {
|
|
@@ -74,5 +74,4 @@ function display(str, callback) {
|
|
|
74
74
|
callback();
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
exports.display = display;
|
|
78
77
|
//# sourceMappingURL=display.js.map
|
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.createRandomFile = createRandomFile;
|
|
7
|
+
exports.createRandomFileIfNotExist = createRandomFileIfNotExist;
|
|
8
|
+
exports.useRandFile = useRandFile;
|
|
7
9
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
8
10
|
// node-opcua-pki
|
|
9
11
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -41,7 +43,6 @@ function createRandomFile(randomFile, options, callback) {
|
|
|
41
43
|
callback(err ? err : undefined);
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
|
-
exports.createRandomFile = createRandomFile;
|
|
45
46
|
function createRandomFileIfNotExist(randomFile, options, callback) {
|
|
46
47
|
const randomFilePath = options.cwd ? path_1.default.join(options.cwd, randomFile) : randomFile;
|
|
47
48
|
if (fs_1.default.existsSync(randomFilePath)) {
|
|
@@ -51,7 +52,6 @@ function createRandomFileIfNotExist(randomFile, options, callback) {
|
|
|
51
52
|
createRandomFile(randomFile, options, callback);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
exports.createRandomFileIfNotExist = createRandomFileIfNotExist;
|
|
55
55
|
function useRandFile() {
|
|
56
56
|
// istanbul ignore next
|
|
57
57
|
if (config_1.g_config.opensslVersion && config_1.g_config.opensslVersion.toLowerCase().indexOf("libressl") > -1) {
|
|
@@ -59,5 +59,4 @@ function useRandFile() {
|
|
|
59
59
|
}
|
|
60
60
|
return true;
|
|
61
61
|
}
|
|
62
|
-
exports.useRandFile = useRandFile;
|
|
63
62
|
//# sourceMappingURL=_create_random_file.js.map
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.exportedEnvVars = void 0;
|
|
4
|
+
exports.setEnv = setEnv;
|
|
5
|
+
exports.hasEnv = hasEnv;
|
|
6
|
+
exports.getEnv = getEnv;
|
|
7
|
+
exports.getEnvironmentVarNames = getEnvironmentVarNames;
|
|
8
|
+
exports.processAltNames = processAltNames;
|
|
4
9
|
const config_1 = require("../config");
|
|
5
10
|
const debug_1 = require("../debug");
|
|
6
11
|
exports.exportedEnvVars = {};
|
|
@@ -17,21 +22,17 @@ function setEnv(varName, value) {
|
|
|
17
22
|
process.env[varName] = value;
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
|
-
exports.setEnv = setEnv;
|
|
21
25
|
function hasEnv(varName) {
|
|
22
26
|
return Object.prototype.hasOwnProperty.call(exports.exportedEnvVars, varName);
|
|
23
27
|
}
|
|
24
|
-
exports.hasEnv = hasEnv;
|
|
25
28
|
function getEnv(varName) {
|
|
26
29
|
return exports.exportedEnvVars[varName];
|
|
27
30
|
}
|
|
28
|
-
exports.getEnv = getEnv;
|
|
29
31
|
function getEnvironmentVarNames() {
|
|
30
32
|
return Object.keys(exports.exportedEnvVars).map((varName) => {
|
|
31
33
|
return { key: varName, pattern: "\\$ENV\\:\\:" + varName };
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
|
-
exports.getEnvironmentVarNames = getEnvironmentVarNames;
|
|
35
36
|
function processAltNames(params) {
|
|
36
37
|
params.dns = params.dns || [];
|
|
37
38
|
params.ip = params.ip || [];
|
|
@@ -43,5 +44,4 @@ function processAltNames(params) {
|
|
|
43
44
|
const subjectAltNameString = subjectAltName.join(", ");
|
|
44
45
|
setEnv("ALTNAME", subjectAltNameString);
|
|
45
46
|
}
|
|
46
|
-
exports.processAltNames = processAltNames;
|
|
47
47
|
//# sourceMappingURL=_env.js.map
|
|
@@ -28,7 +28,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.createCertificateSigningRequestAsync =
|
|
31
|
+
exports.createCertificateSigningRequestAsync = void 0;
|
|
32
|
+
exports.createCertificateSigningRequest = createCertificateSigningRequest;
|
|
32
33
|
const assert_1 = __importDefault(require("assert"));
|
|
33
34
|
const async_1 = __importDefault(require("async"));
|
|
34
35
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -87,6 +88,5 @@ function createCertificateSigningRequest(certificateSigningRequestFilename, para
|
|
|
87
88
|
},
|
|
88
89
|
], (err) => callback(err));
|
|
89
90
|
}
|
|
90
|
-
exports.createCertificateSigningRequest = createCertificateSigningRequest;
|
|
91
91
|
exports.createCertificateSigningRequestAsync = (0, util_1.promisify)(createCertificateSigningRequest);
|
|
92
92
|
//# sourceMappingURL=create_certificate_signing_request.js.map
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createPrivateKeyOld =
|
|
6
|
+
exports.createPrivateKeyOld = createPrivateKeyOld;
|
|
7
7
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
8
8
|
// node-opcua-pki
|
|
9
9
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
@@ -114,5 +114,4 @@ function createPrivateKeyOld(privateKeyFilename, keyLength, callback) {
|
|
|
114
114
|
];
|
|
115
115
|
async_1.default.series(tasks, callback);
|
|
116
116
|
}
|
|
117
|
-
exports.createPrivateKeyOld = createPrivateKeyOld;
|
|
118
117
|
//# sourceMappingURL=create_private_key.js.map
|
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.createSelfSignedCertificate =
|
|
31
|
+
exports.createSelfSignedCertificate = createSelfSignedCertificate;
|
|
32
32
|
const assert_1 = __importDefault(require("assert"));
|
|
33
33
|
const async_1 = __importDefault(require("async"));
|
|
34
34
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -149,5 +149,4 @@ function createSelfSignedCertificate(certificate, params, callback) {
|
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
exports.createSelfSignedCertificate = createSelfSignedCertificate;
|
|
153
152
|
//# sourceMappingURL=create_self_signed_certificate.js.map
|
|
@@ -28,7 +28,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.
|
|
31
|
+
exports.execute = execute;
|
|
32
|
+
exports.find_openssl = find_openssl;
|
|
33
|
+
exports.ensure_openssl_installed = ensure_openssl_installed;
|
|
34
|
+
exports.executeOpensslAsync = executeOpensslAsync;
|
|
35
|
+
exports.execute_openssl_no_failure = execute_openssl_no_failure;
|
|
36
|
+
exports.execute_openssl = execute_openssl;
|
|
32
37
|
const assert_1 = __importDefault(require("assert"));
|
|
33
38
|
const byline_1 = __importDefault(require("byline"));
|
|
34
39
|
const chalk_1 = __importDefault(require("chalk"));
|
|
@@ -100,14 +105,12 @@ function execute(cmd, options, callback) {
|
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
|
-
exports.execute = execute;
|
|
104
108
|
function find_openssl(callback) {
|
|
105
109
|
(0, install_prerequisite_1.get_openssl_exec_path)((err, _opensslPath) => {
|
|
106
110
|
opensslPath = _opensslPath;
|
|
107
111
|
callback(err, opensslPath);
|
|
108
112
|
});
|
|
109
113
|
}
|
|
110
|
-
exports.find_openssl = find_openssl;
|
|
111
114
|
function ensure_openssl_installed(callback) {
|
|
112
115
|
(0, assert_1.default)(typeof callback === "function");
|
|
113
116
|
if (!opensslPath) {
|
|
@@ -133,7 +136,6 @@ function ensure_openssl_installed(callback) {
|
|
|
133
136
|
return callback();
|
|
134
137
|
}
|
|
135
138
|
}
|
|
136
|
-
exports.ensure_openssl_installed = ensure_openssl_installed;
|
|
137
139
|
function executeOpensslAsync(cmd, options) {
|
|
138
140
|
return new Promise((resolve, reject) => {
|
|
139
141
|
execute_openssl(cmd, options, (err, output) => {
|
|
@@ -147,7 +149,6 @@ function executeOpensslAsync(cmd, options) {
|
|
|
147
149
|
});
|
|
148
150
|
});
|
|
149
151
|
}
|
|
150
|
-
exports.executeOpensslAsync = executeOpensslAsync;
|
|
151
152
|
function execute_openssl_no_failure(cmd, options, callback) {
|
|
152
153
|
options = options || {};
|
|
153
154
|
options.hideErrorMessage = true;
|
|
@@ -159,7 +160,6 @@ function execute_openssl_no_failure(cmd, options, callback) {
|
|
|
159
160
|
callback(null, output);
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
|
-
exports.execute_openssl_no_failure = execute_openssl_no_failure;
|
|
163
163
|
function getTempFolder() {
|
|
164
164
|
return os_1.default.tmpdir();
|
|
165
165
|
}
|
|
@@ -188,5 +188,4 @@ function execute_openssl(cmd, options, callback) {
|
|
|
188
188
|
execute((0, common_1.quote)(opensslPath) + " " + cmd, options, callback);
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
exports.execute_openssl = execute_openssl;
|
|
192
191
|
//# sourceMappingURL=execute_openssl.js.map
|
|
@@ -27,7 +27,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.
|
|
30
|
+
exports.check_system_openssl_version = check_system_openssl_version;
|
|
31
|
+
exports.install_prerequisite = install_prerequisite;
|
|
32
|
+
exports.get_openssl_exec_path = get_openssl_exec_path;
|
|
31
33
|
const fs_1 = __importDefault(require("fs"));
|
|
32
34
|
const os_1 = __importDefault(require("os"));
|
|
33
35
|
const path_1 = __importDefault(require("path"));
|
|
@@ -138,7 +140,6 @@ function check_system_openssl_version(callback) {
|
|
|
138
140
|
});
|
|
139
141
|
});
|
|
140
142
|
}
|
|
141
|
-
exports.check_system_openssl_version = check_system_openssl_version;
|
|
142
143
|
function install_and_check_win32_openssl_version(callback) {
|
|
143
144
|
const downloadFolder = path_1.default.join(os_1.default.tmpdir(), ".");
|
|
144
145
|
function get_openssl_folder_win32() {
|
|
@@ -344,7 +345,6 @@ function install_prerequisite(callback) {
|
|
|
344
345
|
return install_and_check_win32_openssl_version(callback);
|
|
345
346
|
}
|
|
346
347
|
}
|
|
347
|
-
exports.install_prerequisite = install_prerequisite;
|
|
348
348
|
function get_openssl_exec_path(callback) {
|
|
349
349
|
(0, assert_1.default)(typeof callback === "function");
|
|
350
350
|
if (process.platform === "win32") {
|
|
@@ -364,5 +364,4 @@ function get_openssl_exec_path(callback) {
|
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
exports.get_openssl_exec_path = get_openssl_exec_path;
|
|
368
367
|
//# sourceMappingURL=install_prerequisite.js.map
|
|
@@ -28,7 +28,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.
|
|
31
|
+
exports.generateStaticConfig = generateStaticConfig;
|
|
32
|
+
exports.getPublicKeyFromPrivateKey = getPublicKeyFromPrivateKey;
|
|
33
|
+
exports.getPublicKeyFromCertificate = getPublicKeyFromCertificate;
|
|
34
|
+
exports.x509Date = x509Date;
|
|
35
|
+
exports.dumpCertificate = dumpCertificate;
|
|
36
|
+
exports.toDer = toDer;
|
|
37
|
+
exports.fingerprint = fingerprint;
|
|
32
38
|
const assert_1 = __importDefault(require("assert"));
|
|
33
39
|
const fs_1 = __importDefault(require("fs"));
|
|
34
40
|
const path_1 = __importDefault(require("path"));
|
|
@@ -55,7 +61,6 @@ function generateStaticConfig(configPath, options) {
|
|
|
55
61
|
fs_1.default.writeFileSync(path_1.default.join(prePath, staticConfigPath), staticConfig);
|
|
56
62
|
return staticConfigPath;
|
|
57
63
|
}
|
|
58
|
-
exports.generateStaticConfig = generateStaticConfig;
|
|
59
64
|
const q = common_1.quote;
|
|
60
65
|
const n = common2_1.make_path;
|
|
61
66
|
/**
|
|
@@ -71,7 +76,6 @@ function getPublicKeyFromPrivateKey(privateKeyFilename, publicKeyFilename, callb
|
|
|
71
76
|
(0, assert_1.default)(fs_1.default.existsSync(privateKeyFilename));
|
|
72
77
|
(0, execute_openssl_1.execute_openssl)("rsa -pubout -in " + q(n(privateKeyFilename)) + " -out " + q(n(publicKeyFilename)), {}, callback);
|
|
73
78
|
}
|
|
74
|
-
exports.getPublicKeyFromPrivateKey = getPublicKeyFromPrivateKey;
|
|
75
79
|
/**
|
|
76
80
|
* extract public key from a certificate
|
|
77
81
|
* openssl x509 -pubkey -in certificate.pem -nottext
|
|
@@ -85,7 +89,6 @@ function getPublicKeyFromCertificate(certificateFilename, publicKeyFilename, cal
|
|
|
85
89
|
(0, assert_1.default)(fs_1.default.existsSync(certificateFilename));
|
|
86
90
|
(0, execute_openssl_1.execute_openssl)("x509 -pubkey -in " + q(n(certificateFilename)) + " > " + q(n(publicKeyFilename)), {}, callback);
|
|
87
91
|
}
|
|
88
|
-
exports.getPublicKeyFromCertificate = getPublicKeyFromCertificate;
|
|
89
92
|
function x509Date(date) {
|
|
90
93
|
date = date || new Date();
|
|
91
94
|
const Y = date.getUTCFullYear();
|
|
@@ -106,7 +109,6 @@ function x509Date(date) {
|
|
|
106
109
|
return w(Y, 4) + w(M, 2) + w(D, 2) + w(h, 2) + w(m, 2) + w(s, 2) + "Z";
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
|
-
exports.x509Date = x509Date;
|
|
110
112
|
/**
|
|
111
113
|
* @param certificate - the certificate file in PEM format, file must exist
|
|
112
114
|
* @param callback
|
|
@@ -116,17 +118,14 @@ function dumpCertificate(certificate, callback) {
|
|
|
116
118
|
(0, assert_1.default)(typeof callback === "function");
|
|
117
119
|
(0, execute_openssl_1.execute_openssl)("x509 " + " -in " + q(n(certificate)) + " -text " + " -noout", {}, callback);
|
|
118
120
|
}
|
|
119
|
-
exports.dumpCertificate = dumpCertificate;
|
|
120
121
|
function toDer(certificatePem, callback) {
|
|
121
122
|
(0, assert_1.default)(fs_1.default.existsSync(certificatePem));
|
|
122
123
|
const certificateDer = certificatePem.replace(".pem", ".der");
|
|
123
124
|
(0, execute_openssl_1.execute_openssl)("x509 " + " -outform der " + " -in " + certificatePem + " -out " + certificateDer, {}, callback);
|
|
124
125
|
}
|
|
125
|
-
exports.toDer = toDer;
|
|
126
126
|
function fingerprint(certificatePem, callback) {
|
|
127
127
|
// openssl x509 -in my_certificate.pem -hash -dates -noout -fingerprint
|
|
128
128
|
(0, assert_1.default)(fs_1.default.existsSync(certificatePem));
|
|
129
129
|
(0, execute_openssl_1.execute_openssl)("x509 " + " -fingerprint " + " -noout " + " -in " + certificatePem, {}, callback);
|
|
130
130
|
}
|
|
131
|
-
exports.fingerprint = fingerprint;
|
|
132
131
|
//# sourceMappingURL=toolbox.js.map
|