node-opcua-server-configuration 2.163.0 → 2.164.2
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/dist/clientTools/certificate_types.d.ts +17 -0
- package/dist/clientTools/certificate_types.js +20 -0
- package/dist/clientTools/certificate_types.js.map +1 -0
- package/dist/clientTools/get_certificate_key_type.d.ts +6 -0
- package/dist/clientTools/get_certificate_key_type.js +55 -0
- package/dist/clientTools/get_certificate_key_type.js.map +1 -0
- package/dist/clientTools/index.d.ts +2 -1
- package/dist/clientTools/index.js +2 -17
- package/dist/clientTools/index.js.map +1 -1
- package/dist/clientTools/push_certificate_management_client.d.ts +10 -10
- package/dist/clientTools/push_certificate_management_client.js +85 -89
- package/dist/clientTools/push_certificate_management_client.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.js +9 -23
- package/dist/index.js.map +1 -1
- package/dist/push_certificate_manager.d.ts +4 -4
- package/dist/push_certificate_manager.js +1 -2
- package/dist/server/certificate_validation.d.ts +15 -0
- package/dist/server/certificate_validation.js +76 -0
- package/dist/server/certificate_validation.js.map +1 -0
- package/dist/server/file_transaction_manager.d.ts +30 -0
- package/dist/server/file_transaction_manager.js +223 -0
- package/dist/server/file_transaction_manager.js.map +1 -0
- package/dist/server/install_certificate_file_watcher.d.ts +1 -1
- package/dist/server/install_certificate_file_watcher.js +8 -14
- package/dist/server/install_certificate_file_watcher.js.map +1 -1
- package/dist/server/install_push_certitifate_management.d.ts +6 -6
- package/dist/server/install_push_certitifate_management.js +61 -65
- package/dist/server/install_push_certitifate_management.js.map +1 -1
- package/dist/server/promote_trust_list.d.ts +1 -1
- package/dist/server/promote_trust_list.js +323 -82
- package/dist/server/promote_trust_list.js.map +1 -1
- package/dist/server/push_certificate_manager/apply_changes.d.ts +3 -0
- package/dist/server/push_certificate_manager/apply_changes.js +59 -0
- package/dist/server/push_certificate_manager/apply_changes.js.map +1 -0
- package/dist/server/push_certificate_manager/create_signing_request.d.ts +5 -0
- package/dist/server/push_certificate_manager/create_signing_request.js +108 -0
- package/dist/server/push_certificate_manager/create_signing_request.js.map +1 -0
- package/dist/server/push_certificate_manager/get_rejected_list.d.ts +3 -0
- package/dist/server/push_certificate_manager/get_rejected_list.js +46 -0
- package/dist/server/push_certificate_manager/get_rejected_list.js.map +1 -0
- package/dist/server/push_certificate_manager/internal_context.d.ts +35 -0
- package/dist/server/push_certificate_manager/internal_context.js +45 -0
- package/dist/server/push_certificate_manager/internal_context.js.map +1 -0
- package/dist/server/push_certificate_manager/subject_to_string.d.ts +3 -0
- package/dist/server/push_certificate_manager/subject_to_string.js +27 -0
- package/dist/server/push_certificate_manager/subject_to_string.js.map +1 -0
- package/dist/server/push_certificate_manager/update_certificate.d.ts +5 -0
- package/dist/server/push_certificate_manager/update_certificate.js +132 -0
- package/dist/server/push_certificate_manager/update_certificate.js.map +1 -0
- package/dist/server/push_certificate_manager/util.d.ts +29 -0
- package/dist/server/push_certificate_manager/util.js +117 -0
- package/dist/server/push_certificate_manager/util.js.map +1 -0
- package/dist/server/push_certificate_manager_helpers.d.ts +5 -2
- package/dist/server/push_certificate_manager_helpers.js +109 -112
- package/dist/server/push_certificate_manager_helpers.js.map +1 -1
- package/dist/server/push_certificate_manager_server_impl.d.ts +16 -29
- package/dist/server/push_certificate_manager_server_impl.js +49 -437
- package/dist/server/push_certificate_manager_server_impl.js.map +1 -1
- package/dist/server/roles_and_permissions.d.ts +1 -1
- package/dist/server/roles_and_permissions.js +24 -27
- package/dist/server/roles_and_permissions.js.map +1 -1
- package/dist/server/tools.d.ts +1 -1
- package/dist/server/tools.js +7 -13
- package/dist/server/tools.js.map +1 -1
- package/dist/server/trust_list_server.d.ts +2 -2
- package/dist/server/trust_list_server.js +40 -29
- package/dist/server/trust_list_server.js.map +1 -1
- package/dist/standard_certificate_types.js +6 -9
- package/dist/standard_certificate_types.js.map +1 -1
- package/dist/trust_list.d.ts +2 -2
- package/dist/trust_list.js +1 -2
- package/dist/trust_list_impl.js +1 -2
- package/dist/trust_list_impl.js.map +1 -1
- package/package.json +29 -30
- package/source/clientTools/certificate_types.ts +21 -0
- package/source/clientTools/get_certificate_key_type.ts +73 -0
- package/source/clientTools/index.ts +2 -1
- package/source/clientTools/push_certificate_management_client.ts +49 -44
- package/source/index.ts +9 -7
- package/source/push_certificate_manager.ts +15 -17
- package/source/server/certificate_validation.ts +103 -0
- package/source/server/file_transaction_manager.ts +253 -0
- package/source/server/install_certificate_file_watcher.ts +15 -11
- package/source/server/install_push_certitifate_management.ts +52 -51
- package/source/server/promote_trust_list.ts +362 -73
- package/source/server/push_certificate_manager/apply_changes.ts +63 -0
- package/source/server/push_certificate_manager/create_signing_request.ts +137 -0
- package/source/server/push_certificate_manager/get_rejected_list.ts +63 -0
- package/source/server/push_certificate_manager/internal_context.ts +63 -0
- package/source/server/push_certificate_manager/subject_to_string.ts +25 -0
- package/source/server/push_certificate_manager/update_certificate.ts +201 -0
- package/source/server/push_certificate_manager/util.ts +145 -0
- package/source/server/push_certificate_manager_helpers.ts +61 -51
- package/source/server/push_certificate_manager_server_impl.ts +94 -553
- package/source/server/roles_and_permissions.ts +7 -8
- package/source/server/tools.ts +2 -5
- package/source/server/trust_list_server.ts +24 -9
- package/source/standard_certificate_types.ts +2 -3
- package/source/trust_list.ts +26 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roles_and_permissions.js","sourceRoot":"","sources":["../../source/server/roles_and_permissions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"roles_and_permissions.js","sourceRoot":"","sources":["../../source/server/roles_and_permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkC,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,MAAM,CAAC,MAAM,wBAAwB,GAAgC;IACjE;QACI,MAAM,EAAE,cAAc,CAAC,SAAS;QAChC,WAAW,EAAE,cAAc,CAAC,MAAM;KACrC;IACD;QACI,MAAM,EAAE,cAAc,CAAC,iBAAiB;QACxC,WAAW,EAAE,cAAc,CAAC,MAAM;KACrC;IACD;QACI,MAAM,EAAE,cAAc,CAAC,cAAc;QACrC,WAAW,EAAE,kBAAkB,CAAC,mEAAmE,CAAC;KACvG;IACD;QACI,MAAM,EAAE,cAAc,CAAC,aAAa;QACpC,WAAW,EAAE,cAAc;KAC9B;CACJ,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAgC;IAChE;QACI,MAAM,EAAE,cAAc,CAAC,aAAa;QACpC,WAAW,EAAE,cAAc;KAC9B;IACD;;;;;;;;GAQD;CACF,CAAC"}
|
package/dist/server/tools.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ISessionContext } from "node-opcua-address-space";
|
|
1
|
+
import { type ISessionContext } from "node-opcua-address-space";
|
|
2
2
|
export declare function hasExpectedUserAccess(context: ISessionContext): boolean;
|
|
3
3
|
export declare function hasEncryptedChannel(context: ISessionContext): boolean;
|
package/dist/server/tools.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const node_opcua_address_space_1 = require("node-opcua-address-space");
|
|
6
|
-
const node_opcua_secure_channel_1 = require("node-opcua-secure-channel");
|
|
7
|
-
function hasExpectedUserAccess(context) {
|
|
8
|
-
if (!context ||
|
|
9
|
-
!context.session ||
|
|
10
|
-
!context.session.userIdentityToken) {
|
|
1
|
+
import { WellKnownRoles } from "node-opcua-address-space";
|
|
2
|
+
import { MessageSecurityMode } from "node-opcua-secure-channel";
|
|
3
|
+
export function hasExpectedUserAccess(context) {
|
|
4
|
+
if (!context || !context.session || !context.session.userIdentityToken) {
|
|
11
5
|
return false;
|
|
12
6
|
}
|
|
13
|
-
return context.currentUserHasRole(
|
|
7
|
+
return context.currentUserHasRole(WellKnownRoles.SecurityAdmin);
|
|
14
8
|
}
|
|
15
|
-
function hasEncryptedChannel(context) {
|
|
16
|
-
return !!(context.session?.channel?.securityMode ===
|
|
9
|
+
export function hasEncryptedChannel(context) {
|
|
10
|
+
return !!(context.session?.channel?.securityMode === MessageSecurityMode.SignAndEncrypt);
|
|
17
11
|
}
|
|
18
12
|
//# sourceMappingURL=tools.js.map
|
package/dist/server/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../source/server/tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../source/server/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,UAAU,qBAAqB,CAAC,OAAwB;IAC1D,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;QACrE,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAwB;IACxD,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,KAAK,mBAAmB,CAAC,cAAc,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
1
|
+
import type { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
2
|
+
import type { AbstractFs } from "node-opcua-file-transfer";
|
|
2
3
|
import { TrustListDataType } from "node-opcua-types";
|
|
3
|
-
import { AbstractFs } from "node-opcua-file-transfer";
|
|
4
4
|
export declare enum TrustListMasks {
|
|
5
5
|
None = 0,
|
|
6
6
|
TrustedCertificates = 1,
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.writeTrustList = writeTrustList;
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const node_opcua_types_1 = require("node-opcua-types");
|
|
12
|
-
const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
|
|
13
|
-
const node_opcua_crypto_1 = require("node-opcua-crypto");
|
|
14
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
15
|
-
const errorLog = (0, node_opcua_debug_1.make_errorLog)("TrustListServer");
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { BinaryStream } from "node-opcua-binary-stream";
|
|
4
|
+
import { readCertificate, readCertificateRevocationList } from "node-opcua-crypto";
|
|
5
|
+
import { make_errorLog } from "node-opcua-debug";
|
|
6
|
+
import { TrustListDataType } from "node-opcua-types";
|
|
7
|
+
const errorLog = make_errorLog("TrustListServer");
|
|
16
8
|
async function readAll(folder) {
|
|
17
9
|
const results = [];
|
|
18
|
-
const files = await
|
|
10
|
+
const files = await fs.promises.readdir(folder);
|
|
19
11
|
for (const f of files) {
|
|
20
|
-
const file =
|
|
21
|
-
const ext =
|
|
12
|
+
const file = path.join(folder, f);
|
|
13
|
+
const ext = path.extname(file);
|
|
22
14
|
if (ext === ".der" || ext === ".pem") {
|
|
23
|
-
const buf = await
|
|
15
|
+
const buf = await readCertificate(file);
|
|
24
16
|
results.push(buf);
|
|
25
17
|
}
|
|
26
18
|
else if (ext === ".crl") {
|
|
27
|
-
|
|
19
|
+
// Strict validation: only accept valid CRL files
|
|
20
|
+
const buf = await readCertificateRevocationList(file);
|
|
28
21
|
results.push(buf);
|
|
29
22
|
}
|
|
30
23
|
else {
|
|
@@ -33,7 +26,7 @@ async function readAll(folder) {
|
|
|
33
26
|
}
|
|
34
27
|
return results;
|
|
35
28
|
}
|
|
36
|
-
var TrustListMasks;
|
|
29
|
+
export var TrustListMasks;
|
|
37
30
|
(function (TrustListMasks) {
|
|
38
31
|
TrustListMasks[TrustListMasks["None"] = 0] = "None";
|
|
39
32
|
TrustListMasks[TrustListMasks["TrustedCertificates"] = 1] = "TrustedCertificates";
|
|
@@ -41,9 +34,9 @@ var TrustListMasks;
|
|
|
41
34
|
TrustListMasks[TrustListMasks["IssuerCertificates"] = 4] = "IssuerCertificates";
|
|
42
35
|
TrustListMasks[TrustListMasks["IssuerCrls"] = 8] = "IssuerCrls";
|
|
43
36
|
TrustListMasks[TrustListMasks["All"] = 15] = "All";
|
|
44
|
-
})(TrustListMasks || (
|
|
45
|
-
async function buildTrustList(certificateManager, trustListFlag) {
|
|
46
|
-
const trustList = new
|
|
37
|
+
})(TrustListMasks || (TrustListMasks = {}));
|
|
38
|
+
export async function buildTrustList(certificateManager, trustListFlag) {
|
|
39
|
+
const trustList = new TrustListDataType({
|
|
47
40
|
specifiedLists: trustListFlag,
|
|
48
41
|
issuerCertificates: undefined,
|
|
49
42
|
issuerCrls: undefined,
|
|
@@ -54,19 +47,37 @@ async function buildTrustList(certificateManager, trustListFlag) {
|
|
|
54
47
|
trustList.trustedCertificates = await readAll(certificateManager.trustedFolder);
|
|
55
48
|
}
|
|
56
49
|
if ((trustListFlag & TrustListMasks.TrustedCrls) === TrustListMasks.TrustedCrls) {
|
|
57
|
-
|
|
50
|
+
const crlFolder = certificateManager.crlFolder;
|
|
51
|
+
if (fs.existsSync(crlFolder)) {
|
|
52
|
+
trustList.trustedCrls = await readAll(crlFolder);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
trustList.trustedCrls = [];
|
|
56
|
+
}
|
|
58
57
|
}
|
|
59
58
|
if ((trustListFlag & TrustListMasks.IssuerCertificates) === TrustListMasks.IssuerCertificates) {
|
|
60
|
-
|
|
59
|
+
const issuersCertFolder = certificateManager.issuersCertFolder;
|
|
60
|
+
if (fs.existsSync(issuersCertFolder)) {
|
|
61
|
+
trustList.issuerCertificates = await readAll(issuersCertFolder);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
trustList.issuerCertificates = [];
|
|
65
|
+
}
|
|
61
66
|
}
|
|
62
67
|
if ((trustListFlag & TrustListMasks.IssuerCrls) === TrustListMasks.IssuerCrls) {
|
|
63
|
-
|
|
68
|
+
const issuersCrlFolder = certificateManager.issuersCrlFolder;
|
|
69
|
+
if (fs.existsSync(issuersCrlFolder)) {
|
|
70
|
+
trustList.issuerCrls = await readAll(issuersCrlFolder);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
trustList.issuerCrls = [];
|
|
74
|
+
}
|
|
64
75
|
}
|
|
65
76
|
return trustList;
|
|
66
77
|
}
|
|
67
|
-
async function writeTrustList(fs, filename, trustListFlag, certificateManager) {
|
|
78
|
+
export async function writeTrustList(fs, filename, trustListFlag, certificateManager) {
|
|
68
79
|
const trustList = await buildTrustList(certificateManager, trustListFlag);
|
|
69
|
-
const stream = new
|
|
80
|
+
const stream = new BinaryStream(trustList.binaryStoreSize());
|
|
70
81
|
trustList.encode(stream);
|
|
71
82
|
await new Promise((resolve, reject) => {
|
|
72
83
|
fs.writeFile(filename, stream.buffer, "binary", (err) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust_list_server.js","sourceRoot":"","sources":["../../source/server/trust_list_server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trust_list_server.js","sourceRoot":"","sources":["../../source/server/trust_list_server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AACnF,O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AAE,CAAC;QAC5E,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,gBAAgB,CAAC;QAC7D,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAClC,SAAS,CAAC,UAAU,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACJ,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC;QAC9B,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAChC,EAAc,EACd,QAAgB,EAChB,aAA6B,EAE7B,kBAA2C;IAE3C,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,CAAC;IAC7D,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxC,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;YACpD,IAAI,GAAG;gBAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;YAC5B,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CertificateType = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @module node-opcua-server-configuration
|
|
6
3
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Application:
|
|
10
|
-
Https:
|
|
11
|
-
RsaMinApplication:
|
|
12
|
-
RsaSha256Application:
|
|
4
|
+
import { resolveNodeId } from "node-opcua-nodeid";
|
|
5
|
+
export const CertificateType = {
|
|
6
|
+
Application: resolveNodeId("ApplicationCertificateType"),
|
|
7
|
+
Https: resolveNodeId("HttpsCertificateType"),
|
|
8
|
+
RsaMinApplication: resolveNodeId("RsaMinApplicationCertificateType"),
|
|
9
|
+
RsaSha256Application: resolveNodeId("RsaSha256ApplicationCertificateType")
|
|
13
10
|
};
|
|
14
11
|
//# sourceMappingURL=standard_certificate_types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard_certificate_types.js","sourceRoot":"","sources":["../source/standard_certificate_types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"standard_certificate_types.js","sourceRoot":"","sources":["../source/standard_certificate_types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,WAAW,EAAE,aAAa,CAAC,4BAA4B,CAAC;IACxD,KAAK,EAAE,aAAa,CAAC,sBAAsB,CAAC;IAC5C,iBAAiB,EAAE,aAAa,CAAC,kCAAkC,CAAC;IACpE,oBAAoB,EAAE,aAAa,CAAC,qCAAqC,CAAC;CAC7E,CAAC"}
|
package/dist/trust_list.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StatusCode } from "node-opcua-status-code";
|
|
1
|
+
import type { StatusCode } from "node-opcua-status-code";
|
|
2
2
|
/**
|
|
3
3
|
* @module node-opcua-server-configuration
|
|
4
4
|
*/
|
|
@@ -45,7 +45,7 @@ export interface ITrustList {
|
|
|
45
45
|
*
|
|
46
46
|
* This method cannot be called if the file object is open
|
|
47
47
|
* @param certificate - The DER encoded Certificate to add as a ByteStrng
|
|
48
|
-
* @param
|
|
48
|
+
* @param isTrustedCerticopy ficate - If TRUE the Certificate is added to the Trusted Certificates List. If FALSE the Certificate is added to the Issuer Certificates List.
|
|
49
49
|
*
|
|
50
50
|
* **Result Code**
|
|
51
51
|
* - BadUserAccessDenied: The current user does not have the rights required.
|
package/dist/trust_list.js
CHANGED
package/dist/trust_list_impl.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// /**
|
|
3
2
|
// * @module node-opcua-server-configuration
|
|
4
3
|
// */
|
|
5
4
|
// import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
6
5
|
// import { ITrustList } from "./trust_list";
|
|
7
|
-
|
|
6
|
+
export {};
|
|
8
7
|
// export class TrustList implements ITrustList {
|
|
9
8
|
// public async closeAndUpdate(
|
|
10
9
|
// applyChangesRequired: boolean
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust_list_impl.js","sourceRoot":"","sources":["../source/trust_list_impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trust_list_impl.js","sourceRoot":"","sources":["../source/trust_list_impl.ts"],"names":[],"mappings":"AAAA,MAAM;AACN,6CAA6C;AAC7C,MAAM;AACN,oEAAoE;AACpE,6CAA6C;;AAE7C,iDAAiD;AAEjD,iCAAiC;AACjC,oCAAoC;AACpC,0BAA0B;AAE1B,oBAAoB;AACpB,MAAM;AAEN,iCAAiC;AACjC,2BAA2B;AAC3B,oCAAoC;AACpC,6BAA6B;AAC7B,4CAA4C;AAC5C,MAAM;AAEN,oCAAoC;AACpC,0BAA0B;AAC1B,oCAAoC;AACpC,6BAA6B;AAC7B,4CAA4C;AAC5C,MAAM;AACN,IAAI"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-server-configuration",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.164.2",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module server-configuration",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -10,42 +10,41 @@
|
|
|
10
10
|
},
|
|
11
11
|
"main": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
+
"type": "module",
|
|
13
14
|
"dependencies": {
|
|
14
15
|
"chalk": "4.1.2",
|
|
15
|
-
"memfs": "^4.56.
|
|
16
|
-
"node-opcua-address-space": "2.
|
|
17
|
-
"node-opcua-address-space-base": "2.
|
|
18
|
-
"node-opcua-assert": "2.
|
|
19
|
-
"node-opcua-basic-types": "2.
|
|
20
|
-
"node-opcua-binary-stream": "2.
|
|
21
|
-
"node-opcua-certificate-manager": "2.
|
|
22
|
-
"node-opcua-common": "2.
|
|
16
|
+
"memfs": "^4.56.11",
|
|
17
|
+
"node-opcua-address-space": "2.164.2",
|
|
18
|
+
"node-opcua-address-space-base": "2.164.0",
|
|
19
|
+
"node-opcua-assert": "2.164.0",
|
|
20
|
+
"node-opcua-basic-types": "2.164.0",
|
|
21
|
+
"node-opcua-binary-stream": "2.164.0",
|
|
22
|
+
"node-opcua-certificate-manager": "2.164.2",
|
|
23
|
+
"node-opcua-common": "2.164.0",
|
|
23
24
|
"node-opcua-constants": "2.157.0",
|
|
24
|
-
"node-opcua-crypto": "
|
|
25
|
-
"node-opcua-data-model": "2.
|
|
26
|
-
"node-opcua-debug": "2.
|
|
27
|
-
"node-opcua-file-transfer": "2.
|
|
28
|
-
"node-opcua-hostname": "2.
|
|
29
|
-
"node-opcua-nodeid": "2.
|
|
30
|
-
"node-opcua-pki": "
|
|
31
|
-
"node-opcua-pseudo-session": "2.
|
|
32
|
-
"node-opcua-secure-channel": "2.
|
|
33
|
-
"node-opcua-server": "2.
|
|
34
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
35
|
-
"node-opcua-status-code": "2.
|
|
36
|
-
"node-opcua-types": "2.
|
|
37
|
-
"node-opcua-variant": "2.
|
|
38
|
-
"rimraf": "6.1.2"
|
|
25
|
+
"node-opcua-crypto": "5.3.0",
|
|
26
|
+
"node-opcua-data-model": "2.164.0",
|
|
27
|
+
"node-opcua-debug": "2.164.0",
|
|
28
|
+
"node-opcua-file-transfer": "2.164.2",
|
|
29
|
+
"node-opcua-hostname": "2.164.0",
|
|
30
|
+
"node-opcua-nodeid": "2.164.0",
|
|
31
|
+
"node-opcua-pki": "6.8.2",
|
|
32
|
+
"node-opcua-pseudo-session": "2.164.2",
|
|
33
|
+
"node-opcua-secure-channel": "2.164.2",
|
|
34
|
+
"node-opcua-server": "2.164.2",
|
|
35
|
+
"node-opcua-service-translate-browse-path": "2.164.0",
|
|
36
|
+
"node-opcua-status-code": "2.164.0",
|
|
37
|
+
"node-opcua-types": "2.164.0",
|
|
38
|
+
"node-opcua-variant": "2.164.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/mocha": "^10.0.10",
|
|
42
42
|
"bcryptjs": "3.0.3",
|
|
43
43
|
"mocha": "11.7.5",
|
|
44
|
-
"node-opcua-client": "2.
|
|
45
|
-
"node-opcua-data-value": "2.
|
|
46
|
-
"node-opcua-leak-detector": "2.
|
|
47
|
-
"node-opcua-nodesets": "2.
|
|
48
|
-
"ts-node": "^10.9.2"
|
|
44
|
+
"node-opcua-client": "2.164.2",
|
|
45
|
+
"node-opcua-data-value": "2.164.0",
|
|
46
|
+
"node-opcua-leak-detector": "2.164.0",
|
|
47
|
+
"node-opcua-nodesets": "2.163.1"
|
|
49
48
|
},
|
|
50
49
|
"author": "Etienne Rossignon",
|
|
51
50
|
"license": "MIT",
|
|
@@ -62,7 +61,7 @@
|
|
|
62
61
|
"internet of things"
|
|
63
62
|
],
|
|
64
63
|
"homepage": "http://node-opcua.github.io/",
|
|
65
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "eb76d34b885c7584785d8eff69ada66f95b55c2e",
|
|
66
65
|
"files": [
|
|
67
66
|
"dist",
|
|
68
67
|
"source"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { resolveNodeId } from "node-opcua-nodeid";
|
|
2
|
+
|
|
3
|
+
// OPC UA Part 12 Certificate Types - defined once to avoid duplication
|
|
4
|
+
export const rsaCertificateTypes = {
|
|
5
|
+
ApplicationInstanceCertificate_RSA_Min_Deprecated: resolveNodeId("ns=0;i=12537"),
|
|
6
|
+
ApplicationInstanceCertificate_RSA_Sha256: resolveNodeId("ns=0;i=12538"),
|
|
7
|
+
ApplicationInstanceCertificate_RSA_Sha256_2048: resolveNodeId("ns=0;i=12541"),
|
|
8
|
+
ApplicationInstanceCertificate_RSA_Sha256_4096: resolveNodeId("ns=0;i=12542")
|
|
9
|
+
} as const;
|
|
10
|
+
export const rsaCertificateTypesArray = Object.values(rsaCertificateTypes);
|
|
11
|
+
|
|
12
|
+
export const eccCertificateTypes = {
|
|
13
|
+
ApplicationInstanceCertificate_ECC_Deprecated: resolveNodeId("ns=0;i=12556"), // deprecated
|
|
14
|
+
ApplicationInstanceCertificate_ECC_nistP256: resolveNodeId("ns=0;i=12557"),
|
|
15
|
+
ApplicationInstanceCertificate_ECC_nistP384: resolveNodeId("ns=0;i=12558"),
|
|
16
|
+
ApplicationInstanceCertificate_ECC_brainpoolP256r1: resolveNodeId("ns=0;i=12559"),
|
|
17
|
+
ApplicationInstanceCertificate_ECC_brainpoolP384r1: resolveNodeId("ns=0;i=12560"),
|
|
18
|
+
ApplicationInstanceCertificate_ECC_curve25519: resolveNodeId("ns=0;i=12561"),
|
|
19
|
+
ApplicationInstanceCertificate_ECC_curve448: resolveNodeId("ns=0;i=12562")
|
|
20
|
+
} as const;
|
|
21
|
+
export const eccCertificateTypesArray = Object.values(eccCertificateTypes);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { exploreCertificate } from "node-opcua-crypto";
|
|
2
|
+
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
3
|
+
|
|
4
|
+
const debugLog = make_debugLog("ServerConfiguration");
|
|
5
|
+
const errorLog = make_errorLog("ServerConfiguration");
|
|
6
|
+
const warningLog = make_warningLog("ServerConfiguration");
|
|
7
|
+
const doDebug = checkDebugFlag("ServerConfiguration");
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Extract the key type from a certificate (RSA or ECC)
|
|
11
|
+
* @param certificate The certificate to analyze
|
|
12
|
+
* @returns "RSA" or "ECC" or null if unknown
|
|
13
|
+
*/
|
|
14
|
+
type AlgorithmIdentifierLike = {
|
|
15
|
+
identifier?: string;
|
|
16
|
+
oid?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Extract the algorithm identifier from an algorithm object or string
|
|
21
|
+
* @param algorithm The algorithm to analyze
|
|
22
|
+
* @returns The algorithm identifier as a string, or undefined if not found
|
|
23
|
+
*/
|
|
24
|
+
function getAlgorithmId(algorithm: unknown): string | undefined {
|
|
25
|
+
if (typeof algorithm === "string") {
|
|
26
|
+
return algorithm;
|
|
27
|
+
}
|
|
28
|
+
if (algorithm && typeof algorithm === "object") {
|
|
29
|
+
const obj = algorithm as AlgorithmIdentifierLike;
|
|
30
|
+
return obj.identifier ?? obj.oid;
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Extract the key type from a certificate (RSA or ECC)
|
|
37
|
+
* @param certificate The certificate to analyze
|
|
38
|
+
* @returns "RSA" or "ECC" or null if unknown
|
|
39
|
+
*/
|
|
40
|
+
export function getCertificateKeyType(certificate: Buffer): "RSA" | "ECC" | null {
|
|
41
|
+
try {
|
|
42
|
+
const certInfo = exploreCertificate(certificate);
|
|
43
|
+
|
|
44
|
+
// Use subject public key algorithm to determine key type
|
|
45
|
+
const publicKeyAlg = certInfo.tbsCertificate?.subjectPublicKeyInfo?.algorithm;
|
|
46
|
+
doDebug && debugLog("Certificate subjectPublicKeyInfo.algorithm:", publicKeyAlg);
|
|
47
|
+
|
|
48
|
+
const algorithmStr = getAlgorithmId(publicKeyAlg);
|
|
49
|
+
|
|
50
|
+
if (!algorithmStr) {
|
|
51
|
+
warningLog("Unable to extract public key algorithm from certificate");
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const algorithmLower = algorithmStr.toLowerCase();
|
|
56
|
+
|
|
57
|
+
// RSA public key OID: 1.2.840.113549.1.1.1
|
|
58
|
+
if (algorithmStr.startsWith("1.2.840.113549.1.1.1") || algorithmLower.includes("rsa")) {
|
|
59
|
+
return "RSA";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// EC public key OID: 1.2.840.10045.2.1
|
|
63
|
+
if (algorithmStr.startsWith("1.2.840.10045.2.1") || algorithmLower.includes("ec") || algorithmLower.includes("ecc")) {
|
|
64
|
+
return "ECC";
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
warningLog("Unknown certificate public key algorithm:", algorithmStr);
|
|
68
|
+
return null;
|
|
69
|
+
} catch (err) {
|
|
70
|
+
errorLog("Error extracting certificate key type:", (err as Error).message);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./certificate_types.js";
|
|
2
|
+
export * from "./push_certificate_management_client.js";
|