node-opcua-server-configuration 2.113.0 → 2.115.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/dist/clientTools/push_certificate_management_client.js +237 -289
- package/dist/clientTools/push_certificate_management_client.js.map +1 -1
- package/dist/server/install_push_certitifate_management.js +117 -136
- package/dist/server/install_push_certitifate_management.js.map +1 -1
- package/dist/server/promote_trust_list.js +117 -134
- package/dist/server/promote_trust_list.js.map +1 -1
- package/dist/server/push_certificate_manager_helpers.js +258 -283
- package/dist/server/push_certificate_manager_helpers.js.map +1 -1
- package/dist/server/push_certificate_manager_server_impl.js +329 -388
- package/dist/server/push_certificate_manager_server_impl.js.map +1 -1
- package/dist/server/tools.js +1 -2
- package/dist/server/tools.js.map +1 -1
- package/dist/server/trust_list_server.js +47 -62
- package/dist/server/trust_list_server.js.map +1 -1
- package/package.json +25 -25
|
@@ -1,13 +1,4 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.ClientPushCertificateManagement = exports.CertificateGroup = exports.TrustListClient = void 0;
|
|
13
4
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
@@ -60,151 +51,130 @@ class TrustListClient extends node_opcua_file_transfer_1.ClientFile {
|
|
|
60
51
|
/**
|
|
61
52
|
* @private
|
|
62
53
|
*/
|
|
63
|
-
_extractMethodIds() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
});
|
|
54
|
+
async _extractMethodIds() {
|
|
55
|
+
const browseResults = await this.session.translateBrowsePath([
|
|
56
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/CloseAndUpdate"),
|
|
57
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/AddCertificate"),
|
|
58
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/RemoveCertificate"),
|
|
59
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/OpenWithMasks") // OpenWithMasks Mandatory
|
|
60
|
+
]);
|
|
61
|
+
this.closeAndUpdateNodeId = browseResults[0].targets[0].targetId;
|
|
62
|
+
this.addCertificateNodeId = browseResults[1].targets[0].targetId;
|
|
63
|
+
this.removeCertificateNodeId = browseResults[2].targets[0].targetId;
|
|
64
|
+
this.openWithMasksNodeId = browseResults[3].targets[0].targetId;
|
|
65
|
+
// istanbul ignore next
|
|
66
|
+
if (!this.openWithMasksNodeId || this.openWithMasksNodeId.isEmpty()) {
|
|
67
|
+
throw new Error("Cannot find mandatory method OpenWithMask on object");
|
|
68
|
+
}
|
|
80
69
|
}
|
|
81
|
-
extractMethodsIds() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
yield _super.extractMethodsIds.call(this);
|
|
87
|
-
yield this._extractMethodIds();
|
|
88
|
-
});
|
|
70
|
+
async extractMethodsIds() {
|
|
71
|
+
await super.extractMethodsIds();
|
|
72
|
+
await this._extractMethodIds();
|
|
89
73
|
}
|
|
90
|
-
openWithMasks(trustListMask) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return this.fileHandle;
|
|
113
|
-
});
|
|
74
|
+
async openWithMasks(trustListMask) {
|
|
75
|
+
// istanbul ignore next
|
|
76
|
+
if (this.fileHandle) {
|
|
77
|
+
throw new Error("File has already be opened");
|
|
78
|
+
}
|
|
79
|
+
await this.ensureInitialized();
|
|
80
|
+
// istanbul ignore next
|
|
81
|
+
if (!this.openWithMasksNodeId) {
|
|
82
|
+
throw new Error("OpenWithMasks doesn't exist");
|
|
83
|
+
}
|
|
84
|
+
const inputArguments = [{ dataType: node_opcua_variant_1.DataType.UInt32, value: trustListMask }];
|
|
85
|
+
const methodToCall = {
|
|
86
|
+
inputArguments,
|
|
87
|
+
methodId: this.openWithMasksNodeId,
|
|
88
|
+
objectId: this.nodeId
|
|
89
|
+
};
|
|
90
|
+
const callMethodResult = await this.session.call(methodToCall);
|
|
91
|
+
if (callMethodResult.statusCode.isNotGood()) {
|
|
92
|
+
throw new Error(callMethodResult.statusCode.name);
|
|
93
|
+
}
|
|
94
|
+
this.fileHandle = callMethodResult.outputArguments[0].value;
|
|
95
|
+
return this.fileHandle;
|
|
114
96
|
}
|
|
115
|
-
closeAndUpdate(applyChangesRequired) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return callMethodResult.outputArguments[0].value;
|
|
138
|
-
});
|
|
97
|
+
async closeAndUpdate(applyChangesRequired) {
|
|
98
|
+
if (!this.fileHandle) {
|
|
99
|
+
throw new Error("File has node been opened yet");
|
|
100
|
+
}
|
|
101
|
+
await this.ensureInitialized();
|
|
102
|
+
if (!this.closeAndUpdateNodeId) {
|
|
103
|
+
throw new Error("CloseAndUpdateMethod doesn't exist");
|
|
104
|
+
}
|
|
105
|
+
const inputArguments = [
|
|
106
|
+
{ dataType: node_opcua_variant_1.DataType.UInt32, value: this.fileHandle },
|
|
107
|
+
{ dataType: node_opcua_variant_1.DataType.Boolean, value: !!applyChangesRequired }
|
|
108
|
+
];
|
|
109
|
+
const methodToCall = {
|
|
110
|
+
inputArguments,
|
|
111
|
+
methodId: this.closeAndUpdateNodeId,
|
|
112
|
+
objectId: this.nodeId
|
|
113
|
+
};
|
|
114
|
+
const callMethodResult = await this.session.call(methodToCall);
|
|
115
|
+
if (callMethodResult.statusCode.isNotGood()) {
|
|
116
|
+
throw new Error(callMethodResult.statusCode.name);
|
|
117
|
+
}
|
|
118
|
+
return callMethodResult.outputArguments[0].value;
|
|
139
119
|
}
|
|
140
|
-
addCertificate(certificate, isTrustedCertificate) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return callMethodResult.statusCode;
|
|
154
|
-
});
|
|
120
|
+
async addCertificate(certificate, isTrustedCertificate) {
|
|
121
|
+
await this.ensureInitialized();
|
|
122
|
+
const inputArguments = [
|
|
123
|
+
{ dataType: node_opcua_variant_1.DataType.ByteString, value: certificate },
|
|
124
|
+
{ dataType: node_opcua_variant_1.DataType.Boolean, value: !!isTrustedCertificate }
|
|
125
|
+
];
|
|
126
|
+
const methodToCall = {
|
|
127
|
+
inputArguments,
|
|
128
|
+
methodId: this.addCertificateNodeId,
|
|
129
|
+
objectId: this.nodeId
|
|
130
|
+
};
|
|
131
|
+
const callMethodResult = await this.session.call(methodToCall);
|
|
132
|
+
return callMethodResult.statusCode;
|
|
155
133
|
}
|
|
156
|
-
removeCertificate(thumbprint, isTrustedCertificate) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return callMethodResult.statusCode;
|
|
170
|
-
});
|
|
134
|
+
async removeCertificate(thumbprint, isTrustedCertificate) {
|
|
135
|
+
await this.ensureInitialized();
|
|
136
|
+
const inputArguments = [
|
|
137
|
+
{ dataType: node_opcua_variant_1.DataType.String, value: thumbprint },
|
|
138
|
+
{ dataType: node_opcua_variant_1.DataType.Boolean, value: !!isTrustedCertificate }
|
|
139
|
+
];
|
|
140
|
+
const methodToCall = {
|
|
141
|
+
inputArguments,
|
|
142
|
+
methodId: this.removeCertificateNodeId,
|
|
143
|
+
objectId: this.nodeId
|
|
144
|
+
};
|
|
145
|
+
const callMethodResult = await this.session.call(methodToCall);
|
|
146
|
+
return callMethodResult.statusCode;
|
|
171
147
|
}
|
|
172
148
|
/**
|
|
173
149
|
* helper function to retrieve the list of certificates ...
|
|
174
150
|
* @returns
|
|
175
151
|
*/
|
|
176
|
-
readTrustedCertificateList() {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return trustList;
|
|
186
|
-
});
|
|
152
|
+
async readTrustedCertificateList() {
|
|
153
|
+
// const size = await this.size();
|
|
154
|
+
const fileHandle = await this.open(node_opcua_file_transfer_1.OpenFileMode.Read);
|
|
155
|
+
const buff = await this.read(65525);
|
|
156
|
+
await this.close();
|
|
157
|
+
const stream = new node_opcua_binary_stream_1.BinaryStream(buff);
|
|
158
|
+
const trustList = new node_opcua_types_1.TrustListDataType();
|
|
159
|
+
trustList.decode(stream);
|
|
160
|
+
return trustList;
|
|
187
161
|
}
|
|
188
|
-
readTrustedCertificateListWithMasks(trustListMask) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
return trustList;
|
|
198
|
-
});
|
|
162
|
+
async readTrustedCertificateListWithMasks(trustListMask) {
|
|
163
|
+
// const size = await this.size();
|
|
164
|
+
const fileHandle = await this.openWithMasks(trustListMask);
|
|
165
|
+
const buff = await this.read(65525);
|
|
166
|
+
await this.close();
|
|
167
|
+
const stream = new node_opcua_binary_stream_1.BinaryStream(buff);
|
|
168
|
+
const trustList = new node_opcua_types_1.TrustListDataType();
|
|
169
|
+
trustList.decode(stream);
|
|
170
|
+
return trustList;
|
|
199
171
|
}
|
|
200
|
-
writeTrustedCertificateList(trustedList) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return yield this.closeAndUpdate(true);
|
|
207
|
-
});
|
|
172
|
+
async writeTrustedCertificateList(trustedList) {
|
|
173
|
+
await this.open(node_opcua_file_transfer_1.OpenFileMode.Write);
|
|
174
|
+
const s = trustedList.binaryStoreSize();
|
|
175
|
+
const stream = new node_opcua_binary_stream_1.BinaryStream(s);
|
|
176
|
+
trustedList.encode(stream);
|
|
177
|
+
return await this.closeAndUpdate(true);
|
|
208
178
|
}
|
|
209
179
|
}
|
|
210
180
|
exports.TrustListClient = TrustListClient;
|
|
@@ -213,29 +183,25 @@ class CertificateGroup {
|
|
|
213
183
|
this.session = session;
|
|
214
184
|
this.nodeId = nodeId;
|
|
215
185
|
}
|
|
216
|
-
getCertificateTypes() {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return dataValue.value.value;
|
|
228
|
-
});
|
|
186
|
+
async getCertificateTypes() {
|
|
187
|
+
const browsePathResult = await this.session.translateBrowsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/CertificateTypes"));
|
|
188
|
+
if (browsePathResult.statusCode.isNotGood()) {
|
|
189
|
+
throw new Error(browsePathResult.statusCode.name);
|
|
190
|
+
}
|
|
191
|
+
const certificateTypesNodeId = browsePathResult.targets[0].targetId;
|
|
192
|
+
const dataValue = await this.session.read({ nodeId: certificateTypesNodeId, attributeId: node_opcua_data_model_1.AttributeIds.Value });
|
|
193
|
+
if (dataValue.statusCode.isNotGood()) {
|
|
194
|
+
throw new Error(browsePathResult.statusCode.name);
|
|
195
|
+
}
|
|
196
|
+
return dataValue.value.value;
|
|
229
197
|
}
|
|
230
|
-
getTrustList() {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return new TrustListClient(this.session, trustListNodeId);
|
|
238
|
-
});
|
|
198
|
+
async getTrustList() {
|
|
199
|
+
const browsePathResult = await this.session.translateBrowsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.nodeId, "/TrustList"));
|
|
200
|
+
if (browsePathResult.statusCode.isNotGood()) {
|
|
201
|
+
throw new Error(browsePathResult.statusCode.name);
|
|
202
|
+
}
|
|
203
|
+
const trustListNodeId = browsePathResult.targets[0].targetId;
|
|
204
|
+
return new TrustListClient(this.session, trustListNodeId);
|
|
239
205
|
}
|
|
240
206
|
}
|
|
241
207
|
exports.CertificateGroup = CertificateGroup;
|
|
@@ -281,32 +247,30 @@ class ClientPushCertificateManagement {
|
|
|
281
247
|
* BadInvalidArgument The certificateTypeId, certificateGroupId or subjectName is not valid.
|
|
282
248
|
* BadUserAccessDenied The current user does not have the rights required.
|
|
283
249
|
*/
|
|
284
|
-
createSigningRequest(certificateGroupId, certificateTypeId, subjectName, regeneratePrivateKey, nonce) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
250
|
+
async createSigningRequest(certificateGroupId, certificateTypeId, subjectName, regeneratePrivateKey, nonce) {
|
|
251
|
+
nonce = nonce || Buffer.alloc(0);
|
|
252
|
+
const inputArguments = [
|
|
253
|
+
{ dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateGroupNodeId(certificateGroupId) },
|
|
254
|
+
{ dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateTypeIdNodeId(certificateTypeId) },
|
|
255
|
+
{ dataType: node_opcua_variant_1.DataType.String, value: subjectName },
|
|
256
|
+
{ dataType: node_opcua_variant_1.DataType.Boolean, value: !!regeneratePrivateKey },
|
|
257
|
+
{ dataType: node_opcua_variant_1.DataType.ByteString, value: nonce }
|
|
258
|
+
];
|
|
259
|
+
const methodToCall = {
|
|
260
|
+
inputArguments,
|
|
261
|
+
methodId: createSigningRequestMethod,
|
|
262
|
+
objectId: serverConfigurationNodeId
|
|
263
|
+
};
|
|
264
|
+
const callMethodResult = await this.session.call(methodToCall);
|
|
265
|
+
if (callMethodResult.statusCode.isGood()) {
|
|
266
|
+
return {
|
|
267
|
+
certificateSigningRequest: callMethodResult.outputArguments[0].value,
|
|
268
|
+
statusCode: callMethodResult.statusCode
|
|
298
269
|
};
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
statusCode: callMethodResult.statusCode
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
return { statusCode: callMethodResult.statusCode };
|
|
308
|
-
}
|
|
309
|
-
});
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
return { statusCode: callMethodResult.statusCode };
|
|
273
|
+
}
|
|
310
274
|
}
|
|
311
275
|
/**
|
|
312
276
|
* GetRejectedList Method returns the list of Certificates that have been rejected by the Server.
|
|
@@ -319,63 +283,59 @@ class ClientPushCertificateManagement {
|
|
|
319
283
|
*
|
|
320
284
|
* @return certificates The DER encoded form of the Certificates rejected by the Server
|
|
321
285
|
*/
|
|
322
|
-
getRejectedList() {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
if (callMethodResult.
|
|
332
|
-
|
|
333
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
certificates: callMethodResult.outputArguments[0].value,
|
|
337
|
-
statusCode: callMethodResult.statusCode
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
return {
|
|
342
|
-
statusCode: callMethodResult.statusCode
|
|
343
|
-
};
|
|
286
|
+
async getRejectedList() {
|
|
287
|
+
const inputArguments = [];
|
|
288
|
+
const methodToCall = {
|
|
289
|
+
inputArguments,
|
|
290
|
+
methodId: getRejectedListMethod,
|
|
291
|
+
objectId: serverConfigurationNodeId
|
|
292
|
+
};
|
|
293
|
+
const callMethodResult = await this.session.call(methodToCall);
|
|
294
|
+
if (callMethodResult.statusCode.isGood()) {
|
|
295
|
+
if (callMethodResult.outputArguments[0].dataType !== node_opcua_variant_1.DataType.ByteString) {
|
|
296
|
+
return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
|
|
344
297
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
349
|
-
const inputArguments = [
|
|
350
|
-
{ dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateGroupNodeId(certificateGroupId) },
|
|
351
|
-
{ dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateTypeIdNodeId(certificateTypeId) },
|
|
352
|
-
{ dataType: node_opcua_variant_1.DataType.ByteString, value: certificate },
|
|
353
|
-
{ dataType: node_opcua_variant_1.DataType.ByteString, arrayType: node_opcua_variant_1.VariantArrayType.Array, value: issuerCertificates },
|
|
354
|
-
{ dataType: node_opcua_variant_1.DataType.String, value: privateKeyFormat || "" },
|
|
355
|
-
{ dataType: node_opcua_variant_1.DataType.ByteString, value: privateKeyFormat ? privateKey : Buffer.alloc(0) }
|
|
356
|
-
];
|
|
357
|
-
const methodToCall = {
|
|
358
|
-
inputArguments,
|
|
359
|
-
methodId: updateCertificateMethod,
|
|
360
|
-
objectId: serverConfigurationNodeId
|
|
298
|
+
return {
|
|
299
|
+
certificates: callMethodResult.outputArguments[0].value,
|
|
300
|
+
statusCode: callMethodResult.statusCode
|
|
361
301
|
};
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
return {
|
|
305
|
+
statusCode: callMethodResult.statusCode
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
async updateCertificate(certificateGroupId, certificateTypeId, certificate, issuerCertificates, privateKeyFormat, privateKey) {
|
|
310
|
+
const inputArguments = [
|
|
311
|
+
{ dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateGroupNodeId(certificateGroupId) },
|
|
312
|
+
{ dataType: node_opcua_variant_1.DataType.NodeId, value: findCertificateTypeIdNodeId(certificateTypeId) },
|
|
313
|
+
{ dataType: node_opcua_variant_1.DataType.ByteString, value: certificate },
|
|
314
|
+
{ dataType: node_opcua_variant_1.DataType.ByteString, arrayType: node_opcua_variant_1.VariantArrayType.Array, value: issuerCertificates },
|
|
315
|
+
{ dataType: node_opcua_variant_1.DataType.String, value: privateKeyFormat || "" },
|
|
316
|
+
{ dataType: node_opcua_variant_1.DataType.ByteString, value: privateKeyFormat ? privateKey : Buffer.alloc(0) }
|
|
317
|
+
];
|
|
318
|
+
const methodToCall = {
|
|
319
|
+
inputArguments,
|
|
320
|
+
methodId: updateCertificateMethod,
|
|
321
|
+
objectId: serverConfigurationNodeId
|
|
322
|
+
};
|
|
323
|
+
const callMethodResult = await this.session.call(methodToCall);
|
|
324
|
+
if (callMethodResult.statusCode.isGood()) {
|
|
325
|
+
if (!callMethodResult.outputArguments || callMethodResult.outputArguments.length !== 1) {
|
|
370
326
|
return {
|
|
371
|
-
|
|
372
|
-
statusCode: callMethodResult.statusCode
|
|
327
|
+
statusCode: node_opcua_status_code_1.StatusCodes.BadInternalError
|
|
373
328
|
};
|
|
329
|
+
// throw Error("Internal Error, expecting 1 output result");
|
|
374
330
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
331
|
+
return {
|
|
332
|
+
applyChangesRequired: callMethodResult.outputArguments[0].value,
|
|
333
|
+
statusCode: callMethodResult.statusCode
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
return { statusCode: callMethodResult.statusCode };
|
|
338
|
+
}
|
|
379
339
|
}
|
|
380
340
|
/**
|
|
381
341
|
* ApplyChanges tells the Server to apply any security changes.
|
|
@@ -398,64 +358,52 @@ class ClientPushCertificateManagement {
|
|
|
398
358
|
* Result Code Description
|
|
399
359
|
* BadUserAccessDenied The current user does not have the rights required.
|
|
400
360
|
*/
|
|
401
|
-
applyChanges() {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
return callMethodResult.statusCode;
|
|
413
|
-
});
|
|
361
|
+
async applyChanges() {
|
|
362
|
+
const methodToCall = {
|
|
363
|
+
inputArguments: [],
|
|
364
|
+
methodId: applyChangesMethod,
|
|
365
|
+
objectId: serverConfigurationNodeId
|
|
366
|
+
};
|
|
367
|
+
const callMethodResult = await this.session.call(methodToCall);
|
|
368
|
+
if (callMethodResult.outputArguments && callMethodResult.outputArguments.length) {
|
|
369
|
+
throw new Error("Invalid output arguments");
|
|
370
|
+
}
|
|
371
|
+
return callMethodResult.statusCode;
|
|
414
372
|
}
|
|
415
|
-
getSupportedPrivateKeyFormats() {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
nodeId: supportedPrivateKeyFormatsNodeId
|
|
420
|
-
});
|
|
421
|
-
return dataValue.value.value;
|
|
373
|
+
async getSupportedPrivateKeyFormats() {
|
|
374
|
+
const dataValue = await this.session.read({
|
|
375
|
+
attributeId: node_opcua_data_model_1.AttributeIds.Value,
|
|
376
|
+
nodeId: supportedPrivateKeyFormatsNodeId
|
|
422
377
|
});
|
|
378
|
+
return dataValue.value.value;
|
|
423
379
|
}
|
|
424
|
-
getCertificateGroupId(certificateGroupName) {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
throw new Error("Not Implemented yet");
|
|
431
|
-
});
|
|
380
|
+
async getCertificateGroupId(certificateGroupName) {
|
|
381
|
+
if (certificateGroupName === "DefaultApplicationGroup") {
|
|
382
|
+
return defaultApplicationGroup;
|
|
383
|
+
}
|
|
384
|
+
// toDO
|
|
385
|
+
throw new Error("Not Implemented yet");
|
|
432
386
|
}
|
|
433
387
|
/**
|
|
434
388
|
*
|
|
435
389
|
* @param browseName
|
|
436
390
|
*/
|
|
437
|
-
getCertificateGroup(browseName) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
throw new Error("Not Implemented yet");
|
|
448
|
-
});
|
|
391
|
+
async getCertificateGroup(browseName) {
|
|
392
|
+
browseName = (0, node_opcua_data_model_1.coerceQualifiedName)(browseName);
|
|
393
|
+
if (browseName.toString() === "DefaultApplicationGroup") {
|
|
394
|
+
return new CertificateGroup(this.session, defaultApplicationGroup);
|
|
395
|
+
}
|
|
396
|
+
if (browseName.toString() === "DefaultUserTokenGroup") {
|
|
397
|
+
return new CertificateGroup(this.session, defaultUserTokenGroup);
|
|
398
|
+
}
|
|
399
|
+
// istanbul ignore next
|
|
400
|
+
throw new Error("Not Implemented yet");
|
|
449
401
|
}
|
|
450
|
-
getApplicationGroup() {
|
|
451
|
-
return
|
|
452
|
-
return this.getCertificateGroup("DefaultApplicationGroup");
|
|
453
|
-
});
|
|
402
|
+
async getApplicationGroup() {
|
|
403
|
+
return this.getCertificateGroup("DefaultApplicationGroup");
|
|
454
404
|
}
|
|
455
|
-
getUserTokenGroup() {
|
|
456
|
-
return
|
|
457
|
-
return this.getCertificateGroup("DefaultUserTokenGroup");
|
|
458
|
-
});
|
|
405
|
+
async getUserTokenGroup() {
|
|
406
|
+
return this.getCertificateGroup("DefaultUserTokenGroup");
|
|
459
407
|
}
|
|
460
408
|
}
|
|
461
409
|
exports.ClientPushCertificateManagement = ClientPushCertificateManagement;
|