node-opcua-chunkmanager 2.98.0 → 2.98.1
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/SequenceHeader.d.ts +19 -0
- package/dist/SequenceHeader.js +48 -0
- package/dist/SequenceHeader.js.map +1 -0
- package/dist/chunk_manager.d.ts +61 -0
- package/dist/chunk_manager.js +222 -0
- package/dist/chunk_manager.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/read_message_header.d.ts +6 -0
- package/dist/read_message_header.js +13 -0
- package/dist/read_message_header.js.map +1 -0
- package/package.json +14 -10
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* @module node-opcua-chunkmanager
|
|
3
|
+
*/
|
|
4
|
+
import { UInt32 } from "node-opcua-basic-types";
|
|
5
|
+
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
6
|
+
import { BaseUAObject, IStructuredTypeSchema } from "node-opcua-factory";
|
|
7
|
+
export interface SequenceHeaderOptions {
|
|
8
|
+
sequenceNumber?: UInt32;
|
|
9
|
+
requestId?: UInt32;
|
|
10
|
+
}
|
|
11
|
+
export declare class SequenceHeader extends BaseUAObject {
|
|
12
|
+
static possibleFields: string[];
|
|
13
|
+
static schema: IStructuredTypeSchema;
|
|
14
|
+
sequenceNumber: UInt32;
|
|
15
|
+
requestId: UInt32;
|
|
16
|
+
constructor(options?: SequenceHeaderOptions);
|
|
17
|
+
encode(stream: OutputBinaryStream): void;
|
|
18
|
+
decode(stream: BinaryStream): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SequenceHeader = void 0;
|
|
4
|
+
/***
|
|
5
|
+
* @module node-opcua-chunkmanager
|
|
6
|
+
*/
|
|
7
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
8
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
9
|
+
const schemaSequenceHeader = (0, node_opcua_factory_1.buildStructuredType)({
|
|
10
|
+
baseType: "BaseUAObject",
|
|
11
|
+
fields: [
|
|
12
|
+
// A monotonically increasing sequence number assigned by the sender to each
|
|
13
|
+
// MessageChunk sent over the ClientSecureChannelLayer.
|
|
14
|
+
{ name: "sequenceNumber", fieldType: "UInt32" },
|
|
15
|
+
// An identifier assigned by the client to OPC UA request Message. All MessageChunks for
|
|
16
|
+
// the request and the associated response use the same identifier.
|
|
17
|
+
{ name: "requestId", fieldType: "UInt32" }
|
|
18
|
+
],
|
|
19
|
+
name: "SequenceHeader"
|
|
20
|
+
});
|
|
21
|
+
class SequenceHeader extends node_opcua_factory_1.BaseUAObject {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
options = options || {};
|
|
24
|
+
super();
|
|
25
|
+
const schema = schemaSequenceHeader;
|
|
26
|
+
/* istanbul ignore next */
|
|
27
|
+
if (node_opcua_factory_1.parameters.debugSchemaHelper) {
|
|
28
|
+
(0, node_opcua_factory_1.check_options_correctness_against_schema)(this, schema, options);
|
|
29
|
+
}
|
|
30
|
+
this.sequenceNumber = (0, node_opcua_factory_1.initialize_field)(schema.fields[0], options.sequenceNumber);
|
|
31
|
+
this.requestId = (0, node_opcua_factory_1.initialize_field)(schema.fields[1], options.requestId);
|
|
32
|
+
}
|
|
33
|
+
encode(stream) {
|
|
34
|
+
super.encode(stream);
|
|
35
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.sequenceNumber, stream);
|
|
36
|
+
(0, node_opcua_basic_types_1.encodeUInt32)(this.requestId, stream);
|
|
37
|
+
}
|
|
38
|
+
decode(stream) {
|
|
39
|
+
super.decode(stream);
|
|
40
|
+
this.sequenceNumber = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
41
|
+
this.requestId = (0, node_opcua_basic_types_1.decodeUInt32)(stream);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
SequenceHeader.possibleFields = ["sequenceNumber", "requestId"];
|
|
45
|
+
SequenceHeader.schema = schemaSequenceHeader;
|
|
46
|
+
exports.SequenceHeader = SequenceHeader;
|
|
47
|
+
SequenceHeader.prototype.schema = SequenceHeader.schema;
|
|
48
|
+
//# sourceMappingURL=SequenceHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SequenceHeader.js","sourceRoot":"","sources":["../source/SequenceHeader.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAA4E;AAE5E,2DAO4B;AAE5B,MAAM,oBAAoB,GAA0B,IAAA,wCAAmB,EAAC;IACpE,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE;QACJ,4EAA4E;QAC5E,uDAAuD;QACvD,EAAE,IAAI,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE;QAC/C,wFAAwF;QACxF,mEAAmE;QACnE,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE;KAC7C;IACD,IAAI,EAAE,gBAAgB;CACzB,CAAC,CAAC;AAMH,MAAa,cAAe,SAAQ,iCAAY;IAM5C,YAAY,OAA+B;QACvC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,KAAK,EAAE,CAAC;QACR,MAAM,MAAM,GAAG,oBAAoB,CAAC;QACpC,0BAA0B;QAC1B,IAAI,+BAAU,CAAC,iBAAiB,EAAE;YAC9B,IAAA,6DAAwC,EAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;SACnE;QACD,IAAI,CAAC,cAAc,GAAG,IAAA,qCAAgB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;QACjF,IAAI,CAAC,SAAS,GAAG,IAAA,qCAAgB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3E,CAAC;IAEM,MAAM,CAAC,MAA0B;QACpC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrB,IAAA,qCAAY,EAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAC1C,IAAA,qCAAY,EAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAEM,MAAM,CAAC,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,IAAA,qCAAY,EAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,IAAA,qCAAY,EAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;;AA3Ba,6BAAc,GAAa,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;AAC3D,qBAAM,GAAG,oBAAoB,CAAC;AAFnC,wCAAc;AA+B3B,cAAc,CAAC,SAAS,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/***
|
|
4
|
+
* @module node-opcua-chunkmanager
|
|
5
|
+
*/
|
|
6
|
+
import { EventEmitter } from "events";
|
|
7
|
+
export declare function verify_message_chunk(messageChunk: Buffer): void;
|
|
8
|
+
export type WriteHeaderFunc = (chunk: Buffer, isLast: boolean, expectedLength: number) => void;
|
|
9
|
+
export type WriteSequenceHeaderFunc = (chunk: Buffer) => void;
|
|
10
|
+
export type SignBufferFunc = (buffer: Buffer) => Buffer;
|
|
11
|
+
export type EncryptBufferFunc = (buffer: Buffer) => Buffer;
|
|
12
|
+
export interface IChunkManagerOptions {
|
|
13
|
+
chunkSize: number;
|
|
14
|
+
signatureLength: number;
|
|
15
|
+
sequenceHeaderSize: number;
|
|
16
|
+
cipherBlockSize: number;
|
|
17
|
+
plainBlockSize: number;
|
|
18
|
+
signBufferFunc?: SignBufferFunc;
|
|
19
|
+
encryptBufferFunc?: EncryptBufferFunc;
|
|
20
|
+
writeSequenceHeaderFunc?: WriteSequenceHeaderFunc;
|
|
21
|
+
headerSize: number;
|
|
22
|
+
writeHeaderFunc?: WriteHeaderFunc;
|
|
23
|
+
}
|
|
24
|
+
export declare class ChunkManager extends EventEmitter {
|
|
25
|
+
signBufferFunc?: SignBufferFunc;
|
|
26
|
+
encryptBufferFunc?: EncryptBufferFunc;
|
|
27
|
+
writeSequenceHeaderFunc?: WriteSequenceHeaderFunc;
|
|
28
|
+
writeHeaderFunc?: WriteHeaderFunc;
|
|
29
|
+
private readonly chunkSize;
|
|
30
|
+
private readonly headerSize;
|
|
31
|
+
private readonly signatureLength;
|
|
32
|
+
private readonly sequenceHeaderSize;
|
|
33
|
+
private readonly cipherBlockSize;
|
|
34
|
+
private readonly plainBlockSize;
|
|
35
|
+
private readonly maxBodySize;
|
|
36
|
+
private readonly maxBlock?;
|
|
37
|
+
private readonly dataOffset;
|
|
38
|
+
private chunk;
|
|
39
|
+
private cursor;
|
|
40
|
+
private pendingChunk;
|
|
41
|
+
private dataEnd;
|
|
42
|
+
constructor(options: IChunkManagerOptions);
|
|
43
|
+
evaluateTotalLengthAndChunks(bodySize: number): {
|
|
44
|
+
totalLength: number;
|
|
45
|
+
chunkCount: number;
|
|
46
|
+
};
|
|
47
|
+
write(buffer: Buffer, length?: number): void;
|
|
48
|
+
end(): void;
|
|
49
|
+
/**
|
|
50
|
+
* compute the signature of the chunk and append it at the end
|
|
51
|
+
* of the data block.
|
|
52
|
+
*
|
|
53
|
+
* @method _write_signature
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
private _write_signature;
|
|
57
|
+
private _encrypt;
|
|
58
|
+
private _push_pending_chunk;
|
|
59
|
+
private _write_padding_bytes;
|
|
60
|
+
private _post_process_current_chunk;
|
|
61
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChunkManager = exports.verify_message_chunk = void 0;
|
|
4
|
+
/***
|
|
5
|
+
* @module node-opcua-chunkmanager
|
|
6
|
+
*/
|
|
7
|
+
const events_1 = require("events");
|
|
8
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
9
|
+
const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
|
|
10
|
+
const node_opcua_buffer_utils_1 = require("node-opcua-buffer-utils");
|
|
11
|
+
const read_message_header_1 = require("./read_message_header");
|
|
12
|
+
function verify_message_chunk(messageChunk) {
|
|
13
|
+
(0, node_opcua_assert_1.assert)(messageChunk);
|
|
14
|
+
(0, node_opcua_assert_1.assert)(messageChunk instanceof Buffer);
|
|
15
|
+
const header = (0, read_message_header_1.readMessageHeader)(new node_opcua_binary_stream_1.BinaryStream(messageChunk));
|
|
16
|
+
if (messageChunk.length !== header.length) {
|
|
17
|
+
throw new Error(" chunk length = " + messageChunk.length + " message length " + header.length);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.verify_message_chunk = verify_message_chunk;
|
|
21
|
+
class ChunkManager extends events_1.EventEmitter {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
super();
|
|
24
|
+
// { chunkSize : 32, headerSize : 10 ,signatureLength: 32 }
|
|
25
|
+
this.chunkSize = options.chunkSize;
|
|
26
|
+
this.headerSize = options.headerSize || 0;
|
|
27
|
+
if (this.headerSize) {
|
|
28
|
+
this.writeHeaderFunc = options.writeHeaderFunc;
|
|
29
|
+
(0, node_opcua_assert_1.assert)(typeof this.writeHeaderFunc === "function");
|
|
30
|
+
}
|
|
31
|
+
this.sequenceHeaderSize = options.sequenceHeaderSize === undefined ? 8 : options.sequenceHeaderSize;
|
|
32
|
+
if (this.sequenceHeaderSize > 0) {
|
|
33
|
+
this.writeSequenceHeaderFunc = options.writeSequenceHeaderFunc;
|
|
34
|
+
(0, node_opcua_assert_1.assert)(typeof this.writeSequenceHeaderFunc === "function");
|
|
35
|
+
}
|
|
36
|
+
this.signatureLength = options.signatureLength || 0;
|
|
37
|
+
this.signBufferFunc = options.signBufferFunc;
|
|
38
|
+
this.plainBlockSize = options.plainBlockSize || 0; // 256-14;
|
|
39
|
+
this.cipherBlockSize = options.cipherBlockSize || 0; // 256;
|
|
40
|
+
this.dataEnd = 0;
|
|
41
|
+
if (this.cipherBlockSize === 0) {
|
|
42
|
+
(0, node_opcua_assert_1.assert)(this.plainBlockSize === 0);
|
|
43
|
+
// unencrypted block
|
|
44
|
+
this.maxBodySize = this.chunkSize - this.headerSize - this.signatureLength - this.sequenceHeaderSize;
|
|
45
|
+
this.encryptBufferFunc = undefined;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
(0, node_opcua_assert_1.assert)(this.plainBlockSize !== 0);
|
|
49
|
+
// During encryption a block with a size equal to PlainTextBlockSize is processed to produce a block
|
|
50
|
+
// with size equal to CipherTextBlockSize. These values depend on the encryption algorithm and may
|
|
51
|
+
// be the same.
|
|
52
|
+
this.encryptBufferFunc = options.encryptBufferFunc;
|
|
53
|
+
(0, node_opcua_assert_1.assert)(typeof this.encryptBufferFunc === "function", "an encryptBufferFunc is required");
|
|
54
|
+
// this is the formula proposed by OPCUA
|
|
55
|
+
this.maxBodySize =
|
|
56
|
+
this.plainBlockSize *
|
|
57
|
+
Math.floor((this.chunkSize - this.headerSize - this.signatureLength - 1) / this.cipherBlockSize) -
|
|
58
|
+
this.sequenceHeaderSize;
|
|
59
|
+
// this is the formula proposed by ERN
|
|
60
|
+
this.maxBlock = Math.floor((this.chunkSize - this.headerSize) / this.cipherBlockSize);
|
|
61
|
+
this.maxBodySize = this.plainBlockSize * this.maxBlock - this.sequenceHeaderSize - this.signatureLength - 1;
|
|
62
|
+
if (this.plainBlockSize > 256) {
|
|
63
|
+
this.maxBodySize -= 1;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
(0, node_opcua_assert_1.assert)(this.maxBodySize > 0); // no space left to write data
|
|
67
|
+
// where the data starts in the block
|
|
68
|
+
this.dataOffset = this.headerSize + this.sequenceHeaderSize;
|
|
69
|
+
this.chunk = null;
|
|
70
|
+
this.cursor = 0;
|
|
71
|
+
this.pendingChunk = null;
|
|
72
|
+
}
|
|
73
|
+
evaluateTotalLengthAndChunks(bodySize) {
|
|
74
|
+
const chunkCount = Math.ceil(bodySize / this.maxBodySize);
|
|
75
|
+
const totalLength = this.chunkSize + chunkCount;
|
|
76
|
+
return { totalLength, chunkCount };
|
|
77
|
+
}
|
|
78
|
+
write(buffer, length) {
|
|
79
|
+
length = length || buffer.length;
|
|
80
|
+
(0, node_opcua_assert_1.assert)(buffer instanceof Buffer || buffer === null);
|
|
81
|
+
(0, node_opcua_assert_1.assert)(length > 0);
|
|
82
|
+
let l = length;
|
|
83
|
+
let inputCursor = 0;
|
|
84
|
+
while (l > 0) {
|
|
85
|
+
(0, node_opcua_assert_1.assert)(length - inputCursor !== 0);
|
|
86
|
+
if (this.cursor === 0) {
|
|
87
|
+
this._push_pending_chunk(false);
|
|
88
|
+
}
|
|
89
|
+
// space left in current chunk
|
|
90
|
+
const spaceLeft = this.maxBodySize - this.cursor;
|
|
91
|
+
const nbToWrite = Math.min(length - inputCursor, spaceLeft);
|
|
92
|
+
this.chunk = this.chunk || (0, node_opcua_buffer_utils_1.createFastUninitializedBuffer)(this.chunkSize);
|
|
93
|
+
if (buffer) {
|
|
94
|
+
buffer.copy(this.chunk, this.cursor + this.dataOffset, inputCursor, inputCursor + nbToWrite);
|
|
95
|
+
}
|
|
96
|
+
inputCursor += nbToWrite;
|
|
97
|
+
this.cursor += nbToWrite;
|
|
98
|
+
if (this.cursor >= this.maxBodySize) {
|
|
99
|
+
this._post_process_current_chunk();
|
|
100
|
+
}
|
|
101
|
+
l -= nbToWrite;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
end() {
|
|
105
|
+
if (this.cursor > 0) {
|
|
106
|
+
this._post_process_current_chunk();
|
|
107
|
+
}
|
|
108
|
+
this._push_pending_chunk(true);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* compute the signature of the chunk and append it at the end
|
|
112
|
+
* of the data block.
|
|
113
|
+
*
|
|
114
|
+
* @method _write_signature
|
|
115
|
+
* @private
|
|
116
|
+
*/
|
|
117
|
+
_write_signature(chunk) {
|
|
118
|
+
if (this.signBufferFunc) {
|
|
119
|
+
(0, node_opcua_assert_1.assert)(typeof this.signBufferFunc === "function");
|
|
120
|
+
(0, node_opcua_assert_1.assert)(this.signatureLength !== 0);
|
|
121
|
+
const signatureStart = this.dataEnd;
|
|
122
|
+
const sectionToSign = chunk.subarray(0, signatureStart);
|
|
123
|
+
const signature = this.signBufferFunc(sectionToSign);
|
|
124
|
+
(0, node_opcua_assert_1.assert)(signature.length === this.signatureLength);
|
|
125
|
+
signature.copy(chunk, signatureStart);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
(0, node_opcua_assert_1.assert)(this.signatureLength === 0, "expecting NO SIGN");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
_encrypt(chunk) {
|
|
132
|
+
if (this.plainBlockSize > 0) {
|
|
133
|
+
(0, node_opcua_assert_1.assert)(this.dataEnd !== undefined);
|
|
134
|
+
const startEncryptionPos = this.headerSize;
|
|
135
|
+
const endEncryptionPos = this.dataEnd + this.signatureLength;
|
|
136
|
+
const areaToEncrypt = chunk.subarray(startEncryptionPos, endEncryptionPos);
|
|
137
|
+
(0, node_opcua_assert_1.assert)(areaToEncrypt.length % this.plainBlockSize === 0); // padding should have been applied
|
|
138
|
+
const nbBlock = areaToEncrypt.length / this.plainBlockSize;
|
|
139
|
+
const encryptedBuffer = this.encryptBufferFunc(areaToEncrypt);
|
|
140
|
+
(0, node_opcua_assert_1.assert)(encryptedBuffer.length % this.cipherBlockSize === 0);
|
|
141
|
+
(0, node_opcua_assert_1.assert)(encryptedBuffer.length === nbBlock * this.cipherBlockSize);
|
|
142
|
+
encryptedBuffer.copy(chunk, this.headerSize, 0);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
_push_pending_chunk(isLast) {
|
|
146
|
+
if (this.pendingChunk) {
|
|
147
|
+
const expectedLength = this.pendingChunk.length;
|
|
148
|
+
if (this.headerSize > 0) {
|
|
149
|
+
// Release 1.02 39 OPC Unified Architecture, Part 6:
|
|
150
|
+
// The sequence header ensures that the first encrypted block of every Message sent over
|
|
151
|
+
// a channel will start with different data.
|
|
152
|
+
this.writeHeaderFunc(this.pendingChunk.subarray(0, this.headerSize), isLast, expectedLength);
|
|
153
|
+
}
|
|
154
|
+
if (this.sequenceHeaderSize > 0) {
|
|
155
|
+
this.writeSequenceHeaderFunc(this.pendingChunk.subarray(this.headerSize, this.headerSize + this.sequenceHeaderSize));
|
|
156
|
+
}
|
|
157
|
+
this._write_signature(this.pendingChunk);
|
|
158
|
+
this._encrypt(this.pendingChunk);
|
|
159
|
+
/**
|
|
160
|
+
* @event chunk
|
|
161
|
+
* @param chunk {Buffer}
|
|
162
|
+
* @param isLast {Boolean} , true if final chunk
|
|
163
|
+
*/
|
|
164
|
+
this.emit("chunk", this.pendingChunk, isLast);
|
|
165
|
+
this.pendingChunk = null;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
_write_padding_bytes(nbPaddingByteTotal) {
|
|
169
|
+
const nbPaddingByte = nbPaddingByteTotal % 256;
|
|
170
|
+
const extraNbPaddingByte = Math.floor(nbPaddingByteTotal / 256);
|
|
171
|
+
(0, node_opcua_assert_1.assert)(extraNbPaddingByte === 0 || this.plainBlockSize > 256, "extraNbPaddingByte only requested when key size > 2048");
|
|
172
|
+
// write the padding byte
|
|
173
|
+
this.chunk.writeUInt8(nbPaddingByte, this.cursor + this.dataOffset);
|
|
174
|
+
this.cursor += 1;
|
|
175
|
+
for (let i = 0; i < nbPaddingByteTotal; i++) {
|
|
176
|
+
this.chunk.writeUInt8(nbPaddingByte, this.cursor + this.dataOffset + i);
|
|
177
|
+
}
|
|
178
|
+
this.cursor += nbPaddingByteTotal;
|
|
179
|
+
if (this.plainBlockSize > 256) {
|
|
180
|
+
this.chunk.writeUInt8(extraNbPaddingByte, this.cursor + this.dataOffset);
|
|
181
|
+
this.cursor += 1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
_post_process_current_chunk() {
|
|
185
|
+
let extraEncryptionBytes = 0;
|
|
186
|
+
// add padding bytes if needed
|
|
187
|
+
if (this.plainBlockSize > 0) {
|
|
188
|
+
// write padding ( if encryption )
|
|
189
|
+
// let's calculate curLength = the length of the block to encrypt without padding yet
|
|
190
|
+
// +---------------+---------------+-------------+---------+--------------+------------+
|
|
191
|
+
// |SequenceHeader | data | paddingByte | padding | extraPadding | signature |
|
|
192
|
+
// +---------------+---------------+-------------+---------+--------------+------------+
|
|
193
|
+
let curLength = this.sequenceHeaderSize + this.cursor + this.signatureLength;
|
|
194
|
+
if (this.plainBlockSize > 256) {
|
|
195
|
+
curLength += 2; // account for extraPadding Byte Number;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
curLength += 1;
|
|
199
|
+
}
|
|
200
|
+
// let's calculate the required number of padding bytes
|
|
201
|
+
const n = curLength % this.plainBlockSize;
|
|
202
|
+
const nbPaddingByteTotal = (this.plainBlockSize - n) % this.plainBlockSize;
|
|
203
|
+
this._write_padding_bytes(nbPaddingByteTotal);
|
|
204
|
+
const adjustedLength = this.sequenceHeaderSize + this.cursor + this.signatureLength;
|
|
205
|
+
(0, node_opcua_assert_1.assert)(adjustedLength % this.plainBlockSize === 0);
|
|
206
|
+
const nbBlock = adjustedLength / this.plainBlockSize;
|
|
207
|
+
extraEncryptionBytes = nbBlock * (this.cipherBlockSize - this.plainBlockSize);
|
|
208
|
+
}
|
|
209
|
+
this.dataEnd = this.dataOffset + this.cursor;
|
|
210
|
+
// calculate the expected length of the chunk, once encrypted if encryption apply
|
|
211
|
+
const expectedLength = this.dataEnd + this.signatureLength + extraEncryptionBytes;
|
|
212
|
+
this.pendingChunk = this.chunk.subarray(0, expectedLength);
|
|
213
|
+
// note :
|
|
214
|
+
// - this.pending_chunk has the correct size but is not signed nor encrypted yet
|
|
215
|
+
// as we don't know what to write in the header yet
|
|
216
|
+
// - as a result,
|
|
217
|
+
this.chunk = null;
|
|
218
|
+
this.cursor = 0;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.ChunkManager = ChunkManager;
|
|
222
|
+
//# sourceMappingURL=chunk_manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_manager.js","sourceRoot":"","sources":["../source/chunk_manager.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mCAAsC;AAEtC,yDAA2C;AAC3C,uEAAwD;AACxD,qEAAwE;AAExE,+DAA0D;AAE1D,SAAgB,oBAAoB,CAAC,YAAoB;IACrD,IAAA,0BAAM,EAAC,YAAY,CAAC,CAAC;IACrB,IAAA,0BAAM,EAAC,YAAY,YAAY,MAAM,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,IAAA,uCAAiB,EAAC,IAAI,uCAAY,CAAC,YAAY,CAAC,CAAC,CAAC;IACjE,IAAI,YAAY,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,YAAY,CAAC,MAAM,GAAG,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;KACnG;AACL,CAAC;AAPD,oDAOC;AAqDD,MAAa,YAAa,SAAQ,qBAAY;IAsB1C,YAAY,OAA6B;QACrC,KAAK,EAAE,CAAC;QAER,2DAA2D;QAC3D,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAEnC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;QAC1C,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;YAC/C,IAAA,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pB,CAAC;CACJ;AA3QD,oCA2QC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/***
|
|
18
|
+
* @module node-opcua-chunkmanager
|
|
19
|
+
*/
|
|
20
|
+
__exportStar(require("./chunk_manager"), exports);
|
|
21
|
+
__exportStar(require("./read_message_header"), exports);
|
|
22
|
+
__exportStar(require("./SequenceHeader"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,kDAAgC;AAChC,wDAAsC;AACtC,mDAAiC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readMessageHeader = void 0;
|
|
4
|
+
function readMessageHeader(stream) {
|
|
5
|
+
const msgType = String.fromCharCode(stream.readUInt8()) +
|
|
6
|
+
String.fromCharCode(stream.readUInt8()) +
|
|
7
|
+
String.fromCharCode(stream.readUInt8());
|
|
8
|
+
const isFinal = String.fromCharCode(stream.readUInt8());
|
|
9
|
+
const length = stream.readUInt32();
|
|
10
|
+
return { msgType, isFinal, length };
|
|
11
|
+
}
|
|
12
|
+
exports.readMessageHeader = readMessageHeader;
|
|
13
|
+
//# sourceMappingURL=read_message_header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_message_header.js","sourceRoot":"","sources":["../source/read_message_header.ts"],"names":[],"mappings":";;;AAMA,SAAgB,iBAAiB,CAAC,MAAoB;IAElD,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACnD,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACvC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACnC,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAC,CAAC;AACtC,CAAC;AATD,8CASC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-chunkmanager",
|
|
3
|
-
"version": "2.98.
|
|
4
|
-
"description": "pure nodejs OPCUA SDK - module
|
|
3
|
+
"version": "2.98.1",
|
|
4
|
+
"description": "pure nodejs OPCUA SDK - module chunkmanager",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"lint": "eslint source/**/*.ts"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"node-opcua-assert": "2.
|
|
15
|
-
"node-opcua-basic-types": "2.98.
|
|
16
|
-
"node-opcua-binary-stream": "2.98.
|
|
17
|
-
"node-opcua-buffer-utils": "2.98.
|
|
18
|
-
"node-opcua-factory": "2.98.
|
|
19
|
-
"node-opcua-packet-assembler": "2.98.
|
|
14
|
+
"node-opcua-assert": "2.98.1",
|
|
15
|
+
"node-opcua-basic-types": "2.98.1",
|
|
16
|
+
"node-opcua-binary-stream": "2.98.1",
|
|
17
|
+
"node-opcua-buffer-utils": "2.98.1",
|
|
18
|
+
"node-opcua-factory": "2.98.1",
|
|
19
|
+
"node-opcua-packet-assembler": "2.98.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "18.15.11",
|
|
23
|
-
"node-opcua-debug": "2.98.
|
|
23
|
+
"node-opcua-debug": "2.98.1",
|
|
24
24
|
"should": "^13.2.3",
|
|
25
25
|
"source-map-support": "^0.5.21"
|
|
26
26
|
},
|
|
@@ -39,5 +39,9 @@
|
|
|
39
39
|
"internet of things"
|
|
40
40
|
],
|
|
41
41
|
"homepage": "http://node-opcua.github.io/",
|
|
42
|
-
"gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c"
|
|
42
|
+
"gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c",
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"source"
|
|
46
|
+
]
|
|
43
47
|
}
|