@digitaldefiance/node-ecies-lib 1.1.11 → 1.1.12
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/README.md +5 -0
- package/dist/constants.js +44 -39
- package/dist/constants.js.map +1 -1
- package/dist/enumerations/index.js +17 -1
- package/dist/enumerations/index.js.map +1 -1
- package/dist/enumerations/pbkdf2-profile.js +5 -2
- package/dist/enumerations/pbkdf2-profile.js.map +1 -1
- package/dist/i18n/ecies-i18n-factory.js +27 -21
- package/dist/i18n/ecies-i18n-factory.js.map +1 -1
- package/dist/i18n/index.js +17 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/dist/interfaces/authenticated-cipher.js +2 -1
- package/dist/interfaces/authenticated-decipher.js +2 -1
- package/dist/interfaces/checksum-config.js +2 -1
- package/dist/interfaces/checksum-consts.js +2 -1
- package/dist/interfaces/constants.js +2 -1
- package/dist/interfaces/ecies-consts.js +2 -1
- package/dist/interfaces/encryption-consts.js +2 -1
- package/dist/interfaces/index.js +33 -17
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/keypair-buffer-with-un-encrypted-private-key.js +2 -1
- package/dist/interfaces/keyring-consts.js +2 -1
- package/dist/interfaces/member-operational.js +2 -1
- package/dist/interfaces/member-with-mnemonic.js +2 -1
- package/dist/interfaces/multi-encrypted-message.js +2 -1
- package/dist/interfaces/multi-encrypted-parsed-header.js +2 -1
- package/dist/interfaces/pbkdf-profiles.js +2 -1
- package/dist/interfaces/pbkdf2-result.js +2 -1
- package/dist/interfaces/signing-key-private-key-info.js +2 -1
- package/dist/interfaces/simple-keypair-buffer.js +2 -1
- package/dist/interfaces/simple-keypair.js +2 -1
- package/dist/interfaces/simple-public-key-only-buffer.js +2 -1
- package/dist/interfaces/simple-public-key-only.js +2 -1
- package/dist/interfaces/single-encrypted-parsed-header.js +2 -1
- package/dist/interfaces/wallet-seed.js +2 -1
- package/dist/interfaces/wrapped-key-consts.js +2 -1
- package/dist/member.js +35 -30
- package/dist/member.js.map +1 -1
- package/dist/services/aes-gcm.js +14 -10
- package/dist/services/aes-gcm.js.map +1 -1
- package/dist/services/ecies/crypto-core.js +29 -25
- package/dist/services/ecies/crypto-core.js.map +1 -1
- package/dist/services/ecies/file.js +39 -2
- package/dist/services/ecies/file.js.map +1 -1
- package/dist/services/ecies/index.js +23 -7
- package/dist/services/ecies/index.js.map +1 -1
- package/dist/services/ecies/multi-recipient.js +50 -46
- package/dist/services/ecies/multi-recipient.js.map +1 -1
- package/dist/services/ecies/service.js +25 -21
- package/dist/services/ecies/service.js.map +1 -1
- package/dist/services/ecies/signature.js +15 -11
- package/dist/services/ecies/signature.js.map +1 -1
- package/dist/services/ecies/single-recipient.js +60 -56
- package/dist/services/ecies/single-recipient.js.map +1 -1
- package/dist/services/ecies/utilities.js +17 -13
- package/dist/services/ecies/utilities.js.map +1 -1
- package/dist/services/index.js +19 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/pbkdf2.js +25 -20
- package/dist/services/pbkdf2.js.map +1 -1
- package/dist/types.js +2 -1
- package/dist/utils.js +26 -22
- package/dist/utils.js.map +1 -1
- package/package.json +3 -4
- package/dist/interfaces/fec-consts.d.ts +0 -5
- package/dist/interfaces/fec-consts.d.ts.map +0 -1
- package/dist/interfaces/fec-consts.js +0 -2
- package/dist/interfaces/fec-consts.js.map +0 -1
- package/dist/services/ecies/crypto-core.debug.d.ts +0 -13
- package/dist/services/ecies/crypto-core.debug.d.ts.map +0 -1
- package/dist/services/ecies/crypto-core.debug.js +0 -91
- package/dist/services/ecies/crypto-core.debug.js.map +0 -1
- package/dist/services/ecies/debug-aes-gcm.d.ts +0 -2
- package/dist/services/ecies/debug-aes-gcm.d.ts.map +0 -1
- package/dist/services/ecies/debug-aes-gcm.js +0 -106
- package/dist/services/ecies/debug-aes-gcm.js.map +0 -1
- package/dist/services/ecies/debug-ecdh.d.ts +0 -2
- package/dist/services/ecies/debug-ecdh.d.ts.map +0 -1
- package/dist/services/ecies/debug-ecdh.js +0 -123
- package/dist/services/ecies/debug-ecdh.js.map +0 -1
- package/dist/services/ecies/debug-ecies-burnbag.d.ts +0 -2
- package/dist/services/ecies/debug-ecies-burnbag.d.ts.map +0 -1
- package/dist/services/ecies/debug-ecies-burnbag.js +0 -134
- package/dist/services/ecies/debug-ecies-burnbag.js.map +0 -1
- package/dist/services/ecies/debug-ecies.d.ts +0 -2
- package/dist/services/ecies/debug-ecies.d.ts.map +0 -1
- package/dist/services/ecies/debug-ecies.js +0 -110
- package/dist/services/ecies/debug-ecies.js.map +0 -1
- package/dist/services/ecies/debug-test.d.ts +0 -2
- package/dist/services/ecies/debug-test.d.ts.map +0 -1
- package/dist/services/ecies/debug-test.js +0 -57
- package/dist/services/ecies/debug-test.js.map +0 -1
package/dist/types.js
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lengthEncodeData = lengthEncodeData;
|
|
4
|
+
exports.decodeLengthEncodedData = decodeLengthEncodedData;
|
|
5
|
+
const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
|
|
6
|
+
const ecies_i18n_factory_1 = require("./i18n/ecies-i18n-factory");
|
|
3
7
|
/**
|
|
4
8
|
* Custom error class for length encoding errors
|
|
5
9
|
*/
|
|
@@ -14,61 +18,61 @@ class LengthEncodingError extends Error {
|
|
|
14
18
|
* @param buffer The buffer to encode
|
|
15
19
|
* @returns The encoded buffer
|
|
16
20
|
*/
|
|
17
|
-
|
|
18
|
-
const lengthType = getLengthEncodingTypeForLength(buffer.length);
|
|
19
|
-
const lengthTypeSize = getLengthForLengthType(lengthType);
|
|
21
|
+
function lengthEncodeData(buffer) {
|
|
22
|
+
const lengthType = (0, ecies_lib_1.getLengthEncodingTypeForLength)(buffer.length);
|
|
23
|
+
const lengthTypeSize = (0, ecies_lib_1.getLengthForLengthType)(lengthType);
|
|
20
24
|
const result = Buffer.alloc(1 + lengthTypeSize + buffer.length);
|
|
21
25
|
result.writeUInt8(lengthType, 0);
|
|
22
26
|
switch (lengthType) {
|
|
23
|
-
case LengthEncodingType.UInt8:
|
|
27
|
+
case ecies_lib_1.LengthEncodingType.UInt8:
|
|
24
28
|
result.writeUInt8(buffer.length, 1);
|
|
25
29
|
break;
|
|
26
|
-
case LengthEncodingType.UInt16:
|
|
30
|
+
case ecies_lib_1.LengthEncodingType.UInt16:
|
|
27
31
|
result.writeUInt16BE(buffer.length, 1);
|
|
28
32
|
break;
|
|
29
|
-
case LengthEncodingType.UInt32:
|
|
33
|
+
case ecies_lib_1.LengthEncodingType.UInt32:
|
|
30
34
|
result.writeUInt32BE(buffer.length, 1);
|
|
31
35
|
break;
|
|
32
|
-
case LengthEncodingType.UInt64:
|
|
36
|
+
case ecies_lib_1.LengthEncodingType.UInt64:
|
|
33
37
|
result.writeBigUInt64BE(BigInt(buffer.length), 1);
|
|
34
38
|
break;
|
|
35
39
|
}
|
|
36
40
|
buffer.copy(result, 1 + lengthTypeSize);
|
|
37
41
|
return result;
|
|
38
42
|
}
|
|
39
|
-
|
|
40
|
-
const pluginEngine = getEciesPluginI18nEngine();
|
|
43
|
+
function decodeLengthEncodedData(buffer) {
|
|
44
|
+
const pluginEngine = (0, ecies_i18n_factory_1.getEciesPluginI18nEngine)();
|
|
41
45
|
if (buffer.length < 1) {
|
|
42
|
-
throw new RangeError(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_BufferIsTooShort));
|
|
46
|
+
throw new RangeError(pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_BufferIsTooShort));
|
|
43
47
|
}
|
|
44
|
-
const lengthType = getLengthEncodingTypeFromValue(buffer.readUint8(0));
|
|
45
|
-
const lengthTypeSize = getLengthForLengthType(lengthType);
|
|
48
|
+
const lengthType = (0, ecies_lib_1.getLengthEncodingTypeFromValue)(buffer.readUint8(0));
|
|
49
|
+
const lengthTypeSize = (0, ecies_lib_1.getLengthForLengthType)(lengthType);
|
|
46
50
|
if (buffer.length < 1 + lengthTypeSize) {
|
|
47
|
-
throw new RangeError(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_BufferIsTooShortToReadFullLengthValue));
|
|
51
|
+
throw new RangeError(pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_BufferIsTooShortToReadFullLengthValue));
|
|
48
52
|
}
|
|
49
53
|
let length;
|
|
50
54
|
switch (lengthType) {
|
|
51
|
-
case LengthEncodingType.UInt8:
|
|
55
|
+
case ecies_lib_1.LengthEncodingType.UInt8:
|
|
52
56
|
length = buffer.readUint8(1);
|
|
53
57
|
break;
|
|
54
|
-
case LengthEncodingType.UInt16:
|
|
58
|
+
case ecies_lib_1.LengthEncodingType.UInt16:
|
|
55
59
|
length = buffer.readUint16BE(1);
|
|
56
60
|
break;
|
|
57
|
-
case LengthEncodingType.UInt32:
|
|
61
|
+
case ecies_lib_1.LengthEncodingType.UInt32:
|
|
58
62
|
length = buffer.readUint32BE(1);
|
|
59
63
|
break;
|
|
60
|
-
case LengthEncodingType.UInt64:
|
|
64
|
+
case ecies_lib_1.LengthEncodingType.UInt64:
|
|
61
65
|
length = buffer.readBigUInt64BE(1);
|
|
62
66
|
if (Number(length) > Number.MAX_SAFE_INTEGER) {
|
|
63
|
-
throw new RangeError(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_LengthExceedsMaximumSafeInteger));
|
|
67
|
+
throw new RangeError(pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_LengthExceedsMaximumSafeInteger));
|
|
64
68
|
}
|
|
65
69
|
break;
|
|
66
70
|
default:
|
|
67
|
-
throw new LengthEncodingError(getNodeEciesTranslation(NodeEciesStringKey.Error_LengthError_LengthIsInvalidType));
|
|
71
|
+
throw new LengthEncodingError((0, ecies_i18n_factory_1.getNodeEciesTranslation)(ecies_i18n_factory_1.NodeEciesStringKey.Error_LengthError_LengthIsInvalidType));
|
|
68
72
|
}
|
|
69
73
|
const totalLength = 1 + lengthTypeSize + Number(length);
|
|
70
74
|
if (totalLength > buffer.length) {
|
|
71
|
-
throw new RangeError(pluginEngine.translate(NodeEciesComponentId, NodeEciesStringKey.Error_BufferIsTooShortForDeclaredDataLength));
|
|
75
|
+
throw new RangeError(pluginEngine.translate(ecies_i18n_factory_1.NodeEciesComponentId, ecies_i18n_factory_1.NodeEciesStringKey.Error_BufferIsTooShortForDeclaredDataLength));
|
|
72
76
|
}
|
|
73
77
|
return {
|
|
74
78
|
data: buffer.subarray(1 + lengthTypeSize, totalLength),
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AA4BA,4CAuBC;AAED,0DAkDC;AAvGD,0DAKoC;AACpC,kEAKmC;AAEnC;;GAEG;AACH,MAAM,mBAAoB,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,MAAc;IAC7C,MAAM,UAAU,GAAuB,IAAA,0CAA8B,EACnE,MAAM,CAAC,MAAM,CACd,CAAC;IACF,MAAM,cAAc,GAAW,IAAA,kCAAsB,EAAC,UAAU,CAAC,CAAC;IAClE,MAAM,MAAM,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACxE,MAAM,CAAC,UAAU,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1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/node-ecies-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "Digital Defiance Node ECIES Library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -50,11 +50,10 @@
|
|
|
50
50
|
],
|
|
51
51
|
"author": "Digital Defiance",
|
|
52
52
|
"license": "MIT",
|
|
53
|
-
"type": "module",
|
|
54
53
|
"packageManager": "yarn@4.10.3",
|
|
55
54
|
"dependencies": {
|
|
56
|
-
"@digitaldefiance/ecies-lib": "1.1.
|
|
57
|
-
"@digitaldefiance/i18n-lib": "1.3.
|
|
55
|
+
"@digitaldefiance/ecies-lib": "1.1.15",
|
|
56
|
+
"@digitaldefiance/i18n-lib": "1.3.5",
|
|
58
57
|
"@ethereumjs/wallet": "^10.0.0",
|
|
59
58
|
"@noble/curves": "^2.0.1",
|
|
60
59
|
"@noble/hashes": "^2.0.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fec-consts.d.ts","sourceRoot":"","sources":["../../src/interfaces/fec-consts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,qCAAqC;IACrC,cAAc,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fec-consts.js","sourceRoot":"","sources":["../../src/interfaces/fec-consts.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test helper for crypto-core debugging - this is a simpler implementation
|
|
3
|
-
* that will help us understand what's happening with the encryption/decryption cycle
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Simple function to encrypt a message with a public key
|
|
7
|
-
*/
|
|
8
|
-
export declare function encryptDebug(receiverPublicKey: Buffer, message: Buffer): Buffer;
|
|
9
|
-
/**
|
|
10
|
-
* Simple function to decrypt a message with a private key
|
|
11
|
-
*/
|
|
12
|
-
export declare function decryptDebug(privateKey: Buffer, encryptedData: Buffer): Buffer;
|
|
13
|
-
//# sourceMappingURL=crypto-core.debug.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-core.debug.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;GAEG;AACH,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,CAwDR;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,MAAM,CAyDR"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test helper for crypto-core debugging - this is a simpler implementation
|
|
3
|
-
* that will help us understand what's happening with the encryption/decryption cycle
|
|
4
|
-
*/
|
|
5
|
-
import { ECIES } from '@digitaldefiance/ecies-lib';
|
|
6
|
-
import { createCipheriv, createDecipheriv, createECDH, randomBytes, } from 'crypto';
|
|
7
|
-
/**
|
|
8
|
-
* Simple function to encrypt a message with a public key
|
|
9
|
-
*/
|
|
10
|
-
export function encryptDebug(receiverPublicKey, message) {
|
|
11
|
-
// Create a new ephemeral key pair for this message
|
|
12
|
-
const ecdh = createECDH(ECIES.CURVE_NAME);
|
|
13
|
-
ecdh.generateKeys();
|
|
14
|
-
// Normalize receiver's public key
|
|
15
|
-
let normalizedPublicKey = receiverPublicKey;
|
|
16
|
-
if (normalizedPublicKey.length === ECIES.RAW_PUBLIC_KEY_LENGTH) {
|
|
17
|
-
normalizedPublicKey = Buffer.concat([
|
|
18
|
-
Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
|
|
19
|
-
normalizedPublicKey,
|
|
20
|
-
]);
|
|
21
|
-
}
|
|
22
|
-
console.log('DEBUG: Receiver public key length:', normalizedPublicKey.length);
|
|
23
|
-
// Compute the shared secret
|
|
24
|
-
const sharedSecret = ecdh.computeSecret(normalizedPublicKey);
|
|
25
|
-
console.log('DEBUG: Shared secret length:', sharedSecret.length);
|
|
26
|
-
// Get ephemeral public key with correct format
|
|
27
|
-
let ephemeralPublicKey = ecdh.getPublicKey();
|
|
28
|
-
if (ephemeralPublicKey.length === ECIES.RAW_PUBLIC_KEY_LENGTH) {
|
|
29
|
-
ephemeralPublicKey = Buffer.concat([
|
|
30
|
-
Buffer.from([ECIES.PUBLIC_KEY_MAGIC]),
|
|
31
|
-
ephemeralPublicKey,
|
|
32
|
-
]);
|
|
33
|
-
}
|
|
34
|
-
console.log('DEBUG: Ephemeral public key length:', ephemeralPublicKey.length);
|
|
35
|
-
// Generate random IV
|
|
36
|
-
const iv = randomBytes(ECIES.IV_SIZE);
|
|
37
|
-
console.log('DEBUG: IV length:', iv.length);
|
|
38
|
-
// Create cipher
|
|
39
|
-
const cipher = createCipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, sharedSecret.subarray(0, ECIES.SYMMETRIC.KEY_SIZE), iv);
|
|
40
|
-
cipher.setAutoPadding(true);
|
|
41
|
-
// Encrypt the message
|
|
42
|
-
let encrypted = cipher.update(message);
|
|
43
|
-
encrypted = Buffer.concat([encrypted, cipher.final()]);
|
|
44
|
-
console.log('DEBUG: Encrypted data length:', encrypted.length);
|
|
45
|
-
// Get authentication tag
|
|
46
|
-
const authTag = cipher.getAuthTag();
|
|
47
|
-
console.log('DEBUG: Auth tag length:', authTag.length);
|
|
48
|
-
// Format the final encrypted buffer
|
|
49
|
-
const output = Buffer.concat([ephemeralPublicKey, iv, authTag, encrypted]);
|
|
50
|
-
console.log('DEBUG: Full output length:', output.length);
|
|
51
|
-
return output;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Simple function to decrypt a message with a private key
|
|
55
|
-
*/
|
|
56
|
-
export function decryptDebug(privateKey, encryptedData) {
|
|
57
|
-
console.log('DEBUG: Input encrypted data length:', encryptedData.length);
|
|
58
|
-
// Parse header components
|
|
59
|
-
const ephemeralPublicKey = encryptedData.subarray(0, ECIES.PUBLIC_KEY_LENGTH);
|
|
60
|
-
console.log('DEBUG: Ephemeral public key length:', ephemeralPublicKey.length);
|
|
61
|
-
const iv = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH, ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE);
|
|
62
|
-
console.log('DEBUG: IV length:', iv.length);
|
|
63
|
-
const authTag = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE, ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE + ECIES.AUTH_TAG_SIZE);
|
|
64
|
-
console.log('DEBUG: Auth tag length:', authTag.length);
|
|
65
|
-
// Extract the ciphertext
|
|
66
|
-
const encrypted = encryptedData.subarray(ECIES.PUBLIC_KEY_LENGTH + ECIES.IV_SIZE + ECIES.AUTH_TAG_SIZE);
|
|
67
|
-
console.log('DEBUG: Ciphertext length:', encrypted.length);
|
|
68
|
-
// Set up ECDH
|
|
69
|
-
const ecdh = createECDH(ECIES.CURVE_NAME);
|
|
70
|
-
ecdh.setPrivateKey(privateKey);
|
|
71
|
-
// Compute shared secret
|
|
72
|
-
const sharedSecret = ecdh.computeSecret(ephemeralPublicKey);
|
|
73
|
-
console.log('DEBUG: Shared secret length:', sharedSecret.length);
|
|
74
|
-
// Create decipher
|
|
75
|
-
const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, sharedSecret.subarray(0, ECIES.SYMMETRIC.KEY_SIZE), iv);
|
|
76
|
-
// Set authentication tag
|
|
77
|
-
decipher.setAuthTag(authTag);
|
|
78
|
-
// Decrypt the data
|
|
79
|
-
try {
|
|
80
|
-
let decrypted = decipher.update(encrypted);
|
|
81
|
-
decrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
82
|
-
console.log('DEBUG: Decrypted data length:', decrypted.length);
|
|
83
|
-
return decrypted;
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
console.error('DEBUG: Decryption failed:', error);
|
|
87
|
-
console.log('DEBUG: First few bytes of ciphertext:', encrypted.subarray(0, 16));
|
|
88
|
-
throw error;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=crypto-core.debug.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-core.debug.js","sourceRoot":"","sources":["../../../src/services/ecies/crypto-core.debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,MAAM,QAAQ,CAAC;AAIhB;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,iBAAyB,EACzB,OAAe;IAEf,mDAAmD;IACnD,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,YAAY,EAAE,CAAC;IAEpB,kCAAkC;IAClC,IAAI,mBAAmB,GAAG,iBAAiB,CAAC;IAC5C,IAAI,mBAAmB,CAAC,MAAM,KAAK,KAAK,CAAC,qBAAqB,EAAE,CAAC;QAC/D,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACrC,mBAAmB;SACpB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAE9E,4BAA4B;IAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAEjE,+CAA+C;IA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ib';
|
|
2
|
-
import { createCipheriv, createDecipheriv, randomBytes } from 'crypto';
|
|
3
|
-
/**
|
|
4
|
-
* This script isolates the symmetric encryption (AES-GCM) part of ECIES
|
|
5
|
-
* to help diagnose issues with the implementation.
|
|
6
|
-
*/
|
|
7
|
-
function debugAesGcm() {
|
|
8
|
-
console.log('=== AES-GCM Encryption/Decryption Debug Test ===\n');
|
|
9
|
-
try {
|
|
10
|
-
// Create a test message
|
|
11
|
-
const message = Buffer.from('This is a test message for AES-GCM encryption/decryption');
|
|
12
|
-
console.log(`Original Message (${message.length} bytes): ${message.toString()}`);
|
|
13
|
-
// Generate a random key (32 bytes for AES-256-GCM) and IV (16 bytes)
|
|
14
|
-
const key = randomBytes(32);
|
|
15
|
-
const iv = randomBytes(16);
|
|
16
|
-
console.log(`\nKey (${key.length} bytes): ${key.toString('hex').substring(0, 32)}...`);
|
|
17
|
-
console.log(`IV (${iv.length} bytes): ${iv.toString('hex')}`);
|
|
18
|
-
// Step 1: Encrypt using AES-GCM
|
|
19
|
-
console.log('\nStep 1: Encrypting message...');
|
|
20
|
-
// Create cipher with the key and IV
|
|
21
|
-
const cipher = createCipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, key, iv);
|
|
22
|
-
// Encrypt the message
|
|
23
|
-
const encrypted = Buffer.concat([cipher.update(message), cipher.final()]);
|
|
24
|
-
// Get the authentication tag
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
const authTag = cipher.getAuthTag();
|
|
27
|
-
console.log(`Encrypted size: ${encrypted.length} bytes`);
|
|
28
|
-
console.log(`Encrypted data (hex): ${encrypted.toString('hex').substring(0, 32)}...`);
|
|
29
|
-
console.log(`Auth Tag (${authTag.length} bytes): ${authTag.toString('hex')}`);
|
|
30
|
-
// Step 2: Decrypt using AES-GCM
|
|
31
|
-
console.log('\nStep 2: Decrypting message...');
|
|
32
|
-
try {
|
|
33
|
-
// Create decipher with the same key and IV
|
|
34
|
-
const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, key, iv);
|
|
35
|
-
// Set the authentication tag
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
|
-
decipher.setAuthTag(authTag);
|
|
38
|
-
// Decrypt the message
|
|
39
|
-
const decrypted = Buffer.concat([
|
|
40
|
-
decipher.update(encrypted),
|
|
41
|
-
decipher.final(),
|
|
42
|
-
]);
|
|
43
|
-
console.log(`Decrypted Message (${decrypted.length} bytes): ${decrypted.toString()}`);
|
|
44
|
-
// Verify that the decrypted message matches the original
|
|
45
|
-
if (decrypted.equals(message)) {
|
|
46
|
-
console.log('✅ Decrypted message matches original!');
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
console.log('❌ Decrypted message does NOT match original!');
|
|
50
|
-
console.log(`Original: ${message.toString('hex')}`);
|
|
51
|
-
console.log(`Decrypted: ${decrypted.toString('hex')}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
console.error('Decryption failed:', error);
|
|
56
|
-
}
|
|
57
|
-
// Step 3: Test with incomplete data
|
|
58
|
-
console.log('\nStep 3: Testing with incomplete data...');
|
|
59
|
-
try {
|
|
60
|
-
// Create decipher with the same key and IV
|
|
61
|
-
const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, key, iv);
|
|
62
|
-
// Set the authentication tag
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
|
-
decipher.setAuthTag(authTag);
|
|
65
|
-
// Try to decrypt with incomplete data (missing the last byte)
|
|
66
|
-
const incompleteEncrypted = encrypted.subarray(0, encrypted.length - 1);
|
|
67
|
-
console.log(`Incomplete encrypted size: ${incompleteEncrypted.length} bytes (missing 1 byte)`);
|
|
68
|
-
const decrypted = Buffer.concat([
|
|
69
|
-
decipher.update(incompleteEncrypted),
|
|
70
|
-
decipher.final(),
|
|
71
|
-
]);
|
|
72
|
-
console.log(`Decrypted from incomplete data: ${decrypted.toString()}`);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
console.error('Decryption of incomplete data failed:', error);
|
|
76
|
-
console.log('✅ Expected failure for incomplete data!');
|
|
77
|
-
}
|
|
78
|
-
// Step 4: Test with incorrect auth tag
|
|
79
|
-
console.log('\nStep 4: Testing with incorrect auth tag...');
|
|
80
|
-
try {
|
|
81
|
-
// Create decipher with the same key and IV
|
|
82
|
-
const decipher = createDecipheriv(ECIES.SYMMETRIC_ALGORITHM_CONFIGURATION, key, iv);
|
|
83
|
-
// Set an incorrect authentication tag
|
|
84
|
-
const wrongAuthTag = Buffer.from(authTag);
|
|
85
|
-
wrongAuthTag[0] = (wrongAuthTag[0] + 1) % 256; // Change the first byte
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
-
decipher.setAuthTag(wrongAuthTag);
|
|
88
|
-
console.log(`Incorrect Auth Tag: ${wrongAuthTag.toString('hex')}`);
|
|
89
|
-
const decrypted = Buffer.concat([
|
|
90
|
-
decipher.update(encrypted),
|
|
91
|
-
decipher.final(),
|
|
92
|
-
]);
|
|
93
|
-
console.log(`Decrypted with wrong auth tag: ${decrypted.toString()}`);
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
console.error('Decryption with wrong auth tag failed:', error);
|
|
97
|
-
console.log('✅ Expected failure for incorrect auth tag!');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
console.error('Debug test failed:', error);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Run the debug test
|
|
105
|
-
debugAesGcm();
|
|
106
|
-
//# sourceMappingURL=debug-aes-gcm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-aes-gcm.js","sourceRoot":"","sources":["../../../src/services/ecies/debug-aes-gcm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE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C,OAAO,CAAC,CAAC;YAC1C,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,wBAAwB;YACvE,8DAA8D;YAC7D,QAAgB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YAE3C,OAAO,CAAC,GAAG,CAAC,uBAAuB,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAEnE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;gBAC9B,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC;gBAC1B,QAAQ,CAAC,KAAK,EAAE;aACjB,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,kCAAkC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACxE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;YAC/D,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,qBAAqB;AACrB,WAAW,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-ecdh.d.ts","sourceRoot":"","sources":["../../../src/services/ecies/debug-ecdh.ts"],"names":[],"mappings":""}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { ECIES } from '@digitaldefiance/ecies-lib';
|
|
2
|
-
import { createECDH } from 'crypto';
|
|
3
|
-
/**
|
|
4
|
-
* Simple debugging script to test ECDH key compatibility issues directly
|
|
5
|
-
*/
|
|
6
|
-
function debugEcdhKeys() {
|
|
7
|
-
console.log('=== Testing ECDH Key Compatibility ===\n');
|
|
8
|
-
try {
|
|
9
|
-
// Create an Alice key pair (first party)
|
|
10
|
-
const aliceEcdh = createECDH(ECIES.CURVE_NAME);
|
|
11
|
-
// Generate keys deterministically
|
|
12
|
-
const aliceSeed = Buffer.from('alice_seed_for_testing_crypto_fix', 'utf8');
|
|
13
|
-
aliceEcdh.setPrivateKey(aliceSeed.subarray(0, 32));
|
|
14
|
-
aliceEcdh.generateKeys();
|
|
15
|
-
const alicePrivateKey = aliceEcdh.getPrivateKey();
|
|
16
|
-
const alicePublicKey = aliceEcdh.getPublicKey();
|
|
17
|
-
// Check if we need to add a prefix to Alice's public key
|
|
18
|
-
const aliceRawPublicKey = alicePublicKey.length === 64
|
|
19
|
-
? alicePublicKey
|
|
20
|
-
: alicePublicKey.subarray(1);
|
|
21
|
-
const aliceFullPublicKey = Buffer.concat([
|
|
22
|
-
Buffer.from([ECIES.PUBLIC_KEY_MAGIC]), // 0x04 prefix
|
|
23
|
-
aliceRawPublicKey,
|
|
24
|
-
]);
|
|
25
|
-
// Create a Bob key pair (second party)
|
|
26
|
-
const bobEcdh = createECDH(ECIES.CURVE_NAME);
|
|
27
|
-
const bobSeed = Buffer.from('bob_seed_for_testing_crypto_fix____', 'utf8');
|
|
28
|
-
bobEcdh.setPrivateKey(bobSeed.subarray(0, 32));
|
|
29
|
-
bobEcdh.generateKeys();
|
|
30
|
-
const bobPrivateKey = bobEcdh.getPrivateKey();
|
|
31
|
-
const bobPublicKey = bobEcdh.getPublicKey();
|
|
32
|
-
// Check if we need to add a prefix to Bob's public key
|
|
33
|
-
const bobRawPublicKey = bobPublicKey.length === 64 ? bobPublicKey : bobPublicKey.subarray(1);
|
|
34
|
-
const bobFullPublicKey = Buffer.concat([
|
|
35
|
-
Buffer.from([ECIES.PUBLIC_KEY_MAGIC]), // 0x04 prefix
|
|
36
|
-
bobRawPublicKey,
|
|
37
|
-
]);
|
|
38
|
-
// Log key formats
|
|
39
|
-
console.log('Alice private key length:', alicePrivateKey.length);
|
|
40
|
-
console.log('Alice raw public key length:', aliceRawPublicKey.length);
|
|
41
|
-
console.log('Alice full public key length:', aliceFullPublicKey.length);
|
|
42
|
-
console.log('Alice full public key prefix:', aliceFullPublicKey[0].toString(16));
|
|
43
|
-
console.log('\nBob private key length:', bobPrivateKey.length);
|
|
44
|
-
console.log('Bob raw public key length:', bobRawPublicKey.length);
|
|
45
|
-
console.log('Bob full public key length:', bobFullPublicKey.length);
|
|
46
|
-
console.log('Bob full public key prefix:', bobFullPublicKey[0].toString(16));
|
|
47
|
-
// Test 1: Try computing shared secret with different key formats
|
|
48
|
-
console.log("\n--- Test 1: Alice computes secret using Bob's public key ---");
|
|
49
|
-
// Try with full key (with 0x04 prefix)
|
|
50
|
-
try {
|
|
51
|
-
const secretWithFullKey = aliceEcdh.computeSecret(bobFullPublicKey);
|
|
52
|
-
console.log('SUCCESS with full key (0x04 prefix)');
|
|
53
|
-
console.log('Shared secret length:', secretWithFullKey.length);
|
|
54
|
-
console.log('Shared secret (hex):', secretWithFullKey.toString('hex').substring(0, 32) + '...');
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
console.error('FAILED with full key (0x04 prefix):', error instanceof Error ? error.message : String(error));
|
|
58
|
-
}
|
|
59
|
-
// Try with raw key (without prefix)
|
|
60
|
-
try {
|
|
61
|
-
const secretWithRawKey = aliceEcdh.computeSecret(bobRawPublicKey);
|
|
62
|
-
console.log('SUCCESS with raw key (no prefix)');
|
|
63
|
-
console.log('Shared secret length:', secretWithRawKey.length);
|
|
64
|
-
console.log('Shared secret (hex):', secretWithRawKey.toString('hex').substring(0, 32) + '...');
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
console.error('FAILED with raw key (no prefix):', error instanceof Error ? error.message : String(error));
|
|
68
|
-
}
|
|
69
|
-
// Test 2: Bob computes secret using Alice's public key
|
|
70
|
-
console.log("\n--- Test 2: Bob computes secret using Alice's public key ---");
|
|
71
|
-
// Try with full key (with 0x04 prefix)
|
|
72
|
-
try {
|
|
73
|
-
const secretWithFullKey = bobEcdh.computeSecret(aliceFullPublicKey);
|
|
74
|
-
console.log('SUCCESS with full key (0x04 prefix)');
|
|
75
|
-
console.log('Shared secret length:', secretWithFullKey.length);
|
|
76
|
-
console.log('Shared secret (hex):', secretWithFullKey.toString('hex').substring(0, 32) + '...');
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
console.error('FAILED with full key (0x04 prefix):', error instanceof Error ? error.message : String(error));
|
|
80
|
-
}
|
|
81
|
-
// Try with raw key (without prefix)
|
|
82
|
-
try {
|
|
83
|
-
const secretWithRawKey = bobEcdh.computeSecret(aliceRawPublicKey);
|
|
84
|
-
console.log('SUCCESS with raw key (no prefix)');
|
|
85
|
-
console.log('Shared secret length:', secretWithRawKey.length);
|
|
86
|
-
console.log('Shared secret (hex):', secretWithRawKey.toString('hex').substring(0, 32) + '...');
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
console.error('FAILED with raw key (no prefix):', error instanceof Error ? error.message : String(error));
|
|
90
|
-
}
|
|
91
|
-
// Test 3: Verify both sides get the same shared secret
|
|
92
|
-
console.log('\n--- Test 3: Compare computed secrets using consistent format ---');
|
|
93
|
-
// Use the format that worked best in tests 1 and 2
|
|
94
|
-
let aliceSecret, bobSecret;
|
|
95
|
-
try {
|
|
96
|
-
aliceSecret = aliceEcdh.computeSecret(bobRawPublicKey); // Try raw format
|
|
97
|
-
bobSecret = bobEcdh.computeSecret(aliceRawPublicKey);
|
|
98
|
-
console.log("Alice's computed secret:", aliceSecret.toString('hex').substring(0, 32) + '...');
|
|
99
|
-
console.log("Bob's computed secret:", bobSecret.toString('hex').substring(0, 32) + '...');
|
|
100
|
-
console.log('Secrets match?', aliceSecret.equals(bobSecret) ? 'YES' : 'NO');
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
console.error('FAILED comparing secrets:', error instanceof Error ? error.message : String(error));
|
|
104
|
-
// Try with full key format if raw format failed
|
|
105
|
-
try {
|
|
106
|
-
aliceSecret = aliceEcdh.computeSecret(bobFullPublicKey);
|
|
107
|
-
bobSecret = bobEcdh.computeSecret(aliceFullPublicKey);
|
|
108
|
-
console.log("Alice's computed secret (full key):", aliceSecret.toString('hex').substring(0, 32) + '...');
|
|
109
|
-
console.log("Bob's computed secret (full key):", bobSecret.toString('hex').substring(0, 32) + '...');
|
|
110
|
-
console.log('Secrets match?', aliceSecret.equals(bobSecret) ? 'YES' : 'NO');
|
|
111
|
-
}
|
|
112
|
-
catch (innerError) {
|
|
113
|
-
console.error('FAILED with both key formats. Something is fundamentally wrong with the key exchange.', innerError instanceof Error ? innerError.message : String(innerError));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
console.error('An error occurred during ECDH key testing:', error instanceof Error ? error.message : String(error));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
// Run the debug test
|
|
122
|
-
debugEcdhKeys();
|
|
123
|
-
//# sourceMappingURL=debug-ecdh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-ecdh.js","sourceRoot":"","sources":["../../../src/services/ecies/debug-ecdh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;GAEG;AACH,SAAS,aAAa;IACpB,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IAExD,IAAI,CAAC;QACH,yCAAyC;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC/C,kCAAkC;QAClC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;QAC3E,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAA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