@lindorm/aes 0.3.0 → 0.3.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/CHANGELOG.md +8 -0
- package/dist/classes/AesKit.js +6 -6
- package/dist/classes/AesKit.js.map +1 -1
- package/dist/constants/private/format.d.ts +1 -1
- package/dist/constants/private/format.d.ts.map +1 -1
- package/dist/constants/private/format.js +2 -2
- package/dist/constants/private/format.js.map +1 -1
- package/dist/types/aes-data.d.ts +0 -1
- package/dist/types/aes-data.d.ts.map +1 -1
- package/dist/types/aes-encryption-data.d.ts +0 -1
- package/dist/types/aes-encryption-data.d.ts.map +1 -1
- package/dist/types/private/auth-tag.d.ts +0 -2
- package/dist/types/private/auth-tag.d.ts.map +1 -1
- package/dist/types/private/content-encryption-key.d.ts +0 -1
- package/dist/types/private/content-encryption-key.d.ts.map +1 -1
- package/dist/types/private/key-wrap.d.ts +0 -1
- package/dist/types/private/key-wrap.d.ts.map +1 -1
- package/dist/utils/private/aes-cipher.d.ts +4 -4
- package/dist/utils/private/aes-cipher.d.ts.map +1 -1
- package/dist/utils/private/aes-cipher.js +10 -10
- package/dist/utils/private/aes-cipher.js.map +1 -1
- package/dist/utils/private/aes-data/auth-tag-hmac.d.ts +2 -3
- package/dist/utils/private/aes-data/auth-tag-hmac.d.ts.map +1 -1
- package/dist/utils/private/aes-data/auth-tag-hmac.js +8 -8
- package/dist/utils/private/aes-data/auth-tag-hmac.js.map +1 -1
- package/dist/utils/private/aes-data/auth-tag.d.ts +2 -3
- package/dist/utils/private/aes-data/auth-tag.d.ts.map +1 -1
- package/dist/utils/private/aes-data/auth-tag.js +7 -7
- package/dist/utils/private/aes-data/auth-tag.js.map +1 -1
- package/dist/utils/private/aes-data/get-initialisation-vector.d.ts +1 -2
- package/dist/utils/private/aes-data/get-initialisation-vector.d.ts.map +1 -1
- package/dist/utils/private/aes-data/get-initialisation-vector.js +3 -3
- package/dist/utils/private/aes-data/get-initialisation-vector.js.map +1 -1
- package/dist/utils/private/aes-data/split-content-encryption-key.d.ts +1 -2
- package/dist/utils/private/aes-data/split-content-encryption-key.d.ts.map +1 -1
- package/dist/utils/private/aes-data/split-content-encryption-key.js +3 -3
- package/dist/utils/private/aes-data/split-content-encryption-key.js.map +1 -1
- package/dist/utils/private/aes-data.d.ts +2 -2
- package/dist/utils/private/aes-data.d.ts.map +1 -1
- package/dist/utils/private/aes-data.js +15 -15
- package/dist/utils/private/aes-data.js.map +1 -1
- package/dist/utils/private/calculate/calculate-aes-encryption.d.ts +1 -1
- package/dist/utils/private/calculate/calculate-aes-encryption.d.ts.map +1 -1
- package/dist/utils/private/calculate/calculate-aes-encryption.js +3 -3
- package/dist/utils/private/calculate/calculate-aes-encryption.js.map +1 -1
- package/dist/utils/private/calculate/calculate-content-encryption-key-size.d.ts +1 -1
- package/dist/utils/private/calculate/calculate-content-encryption-key-size.d.ts.map +1 -1
- package/dist/utils/private/calculate/calculate-content-encryption-key-size.js +3 -3
- package/dist/utils/private/calculate/calculate-content-encryption-key-size.js.map +1 -1
- package/dist/utils/private/calculate/calculate-key-wrap-encryption.d.ts +1 -1
- package/dist/utils/private/calculate/calculate-key-wrap-encryption.d.ts.map +1 -1
- package/dist/utils/private/calculate/calculate-key-wrap-encryption.js +3 -3
- package/dist/utils/private/calculate/calculate-key-wrap-encryption.js.map +1 -1
- package/dist/utils/private/calculate/calculate-key-wrap-size.d.ts +1 -1
- package/dist/utils/private/calculate/calculate-key-wrap-size.d.ts.map +1 -1
- package/dist/utils/private/calculate/calculate-key-wrap-size.js +3 -3
- package/dist/utils/private/calculate/calculate-key-wrap-size.js.map +1 -1
- package/dist/utils/private/calculate/calculate-pbkdf-hash.d.ts +1 -1
- package/dist/utils/private/calculate/calculate-pbkdf-hash.d.ts.map +1 -1
- package/dist/utils/private/calculate/calculate-pbkdf-hash.js +3 -3
- package/dist/utils/private/calculate/calculate-pbkdf-hash.js.map +1 -1
- package/dist/utils/private/calculate/calculate-rsa-oaep-hash.d.ts +1 -1
- package/dist/utils/private/calculate/calculate-rsa-oaep-hash.d.ts.map +1 -1
- package/dist/utils/private/calculate/calculate-rsa-oaep-hash.js +3 -3
- package/dist/utils/private/calculate/calculate-rsa-oaep-hash.js.map +1 -1
- package/dist/utils/private/decode-aes-string.d.ts +1 -1
- package/dist/utils/private/decode-aes-string.d.ts.map +1 -1
- package/dist/utils/private/decode-aes-string.js +12 -12
- package/dist/utils/private/decode-aes-string.js.map +1 -1
- package/dist/utils/private/diffie-hellman/diffie-hellman-key-wrap.d.ts +2 -2
- package/dist/utils/private/diffie-hellman/diffie-hellman-key-wrap.d.ts.map +1 -1
- package/dist/utils/private/diffie-hellman/diffie-hellman-key-wrap.js +14 -14
- package/dist/utils/private/diffie-hellman/diffie-hellman-key-wrap.js.map +1 -1
- package/dist/utils/private/diffie-hellman/diffie-hellman.d.ts +2 -2
- package/dist/utils/private/diffie-hellman/diffie-hellman.d.ts.map +1 -1
- package/dist/utils/private/diffie-hellman/diffie-hellman.js +11 -11
- package/dist/utils/private/diffie-hellman/diffie-hellman.js.map +1 -1
- package/dist/utils/private/diffie-hellman/shared-secret.d.ts +2 -3
- package/dist/utils/private/diffie-hellman/shared-secret.d.ts.map +1 -1
- package/dist/utils/private/diffie-hellman/shared-secret.js +7 -7
- package/dist/utils/private/diffie-hellman/shared-secret.js.map +1 -1
- package/dist/utils/private/encode-aes-string.d.ts +1 -1
- package/dist/utils/private/encode-aes-string.d.ts.map +1 -1
- package/dist/utils/private/encode-aes-string.js +12 -12
- package/dist/utils/private/encode-aes-string.js.map +1 -1
- package/dist/utils/private/get-key/get-decryption-key.d.ts +1 -1
- package/dist/utils/private/get-key/get-decryption-key.d.ts.map +1 -1
- package/dist/utils/private/get-key/get-decryption-key.js +7 -7
- package/dist/utils/private/get-key/get-decryption-key.js.map +1 -1
- package/dist/utils/private/get-key/get-encryption-key.d.ts +1 -1
- package/dist/utils/private/get-key/get-encryption-key.d.ts.map +1 -1
- package/dist/utils/private/get-key/get-encryption-key.js +7 -7
- package/dist/utils/private/get-key/get-encryption-key.js.map +1 -1
- package/dist/utils/private/key-derivation/hkdf.d.ts +1 -2
- package/dist/utils/private/key-derivation/hkdf.d.ts.map +1 -1
- package/dist/utils/private/key-derivation/hkdf.js +3 -3
- package/dist/utils/private/key-derivation/hkdf.js.map +1 -1
- package/dist/utils/private/key-derivation/pbkdf.d.ts +1 -2
- package/dist/utils/private/key-derivation/pbkdf.d.ts.map +1 -1
- package/dist/utils/private/key-derivation/pbkdf.js +3 -3
- package/dist/utils/private/key-derivation/pbkdf.js.map +1 -1
- package/dist/utils/private/key-types/get-ec-keys.d.ts +2 -2
- package/dist/utils/private/key-types/get-ec-keys.d.ts.map +1 -1
- package/dist/utils/private/key-types/get-ec-keys.js +9 -9
- package/dist/utils/private/key-types/get-ec-keys.js.map +1 -1
- package/dist/utils/private/key-types/get-oct-keys.d.ts +2 -2
- package/dist/utils/private/key-types/get-oct-keys.d.ts.map +1 -1
- package/dist/utils/private/key-types/get-oct-keys.js +11 -11
- package/dist/utils/private/key-types/get-oct-keys.js.map +1 -1
- package/dist/utils/private/key-types/get-okp-keys.d.ts +2 -2
- package/dist/utils/private/key-types/get-okp-keys.d.ts.map +1 -1
- package/dist/utils/private/key-types/get-okp-keys.js +9 -9
- package/dist/utils/private/key-types/get-okp-keys.js.map +1 -1
- package/dist/utils/private/key-types/get-rsa-keys.d.ts +2 -2
- package/dist/utils/private/key-types/get-rsa-keys.d.ts.map +1 -1
- package/dist/utils/private/key-types/get-rsa-keys.js +8 -8
- package/dist/utils/private/key-types/get-rsa-keys.js.map +1 -1
- package/dist/utils/private/key-wrap/ecb-key-wrap.d.ts +2 -2
- package/dist/utils/private/key-wrap/ecb-key-wrap.d.ts.map +1 -1
- package/dist/utils/private/key-wrap/ecb-key-wrap.js +7 -7
- package/dist/utils/private/key-wrap/ecb-key-wrap.js.map +1 -1
- package/dist/utils/private/key-wrap/gcm-key-wrap.d.ts +2 -2
- package/dist/utils/private/key-wrap/gcm-key-wrap.d.ts.map +1 -1
- package/dist/utils/private/key-wrap/gcm-key-wrap.js +7 -7
- package/dist/utils/private/key-wrap/gcm-key-wrap.js.map +1 -1
- package/dist/utils/private/key-wrap/key-wrap.d.ts +2 -2
- package/dist/utils/private/key-wrap/key-wrap.d.ts.map +1 -1
- package/dist/utils/private/key-wrap/key-wrap.js +9 -9
- package/dist/utils/private/key-wrap/key-wrap.js.map +1 -1
- package/dist/utils/private/oct/get-oct-dir-keys.d.ts +2 -2
- package/dist/utils/private/oct/get-oct-dir-keys.d.ts.map +1 -1
- package/dist/utils/private/oct/get-oct-dir-keys.js +7 -7
- package/dist/utils/private/oct/get-oct-dir-keys.js.map +1 -1
- package/dist/utils/private/oct/get-oct-key-key-wrap.d.ts +2 -2
- package/dist/utils/private/oct/get-oct-key-key-wrap.d.ts.map +1 -1
- package/dist/utils/private/oct/get-oct-key-key-wrap.js +12 -12
- package/dist/utils/private/oct/get-oct-key-key-wrap.js.map +1 -1
- package/dist/utils/private/oct/get-oct-pbkdf-key-wrap-keys.d.ts +2 -2
- package/dist/utils/private/oct/get-oct-pbkdf-key-wrap-keys.d.ts.map +1 -1
- package/dist/utils/private/oct/get-oct-pbkdf-key-wrap-keys.js +14 -14
- package/dist/utils/private/oct/get-oct-pbkdf-key-wrap-keys.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-aes-encryption.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":";;;AACA,4CAA2C;AAGpC,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-aes-encryption.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-aes-encryption.ts"],"names":[],"mappings":";;;AACA,4CAA2C;AAGpC,MAAM,sBAAsB,GAAG,CAAC,UAA6B,EAAiB,EAAE;IACrF,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,eAAe;YAClB,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC;QAEvB;YACE,MAAM,IAAI,iBAAQ,CAAC,kCAAkC,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AAvBW,QAAA,sBAAsB,0BAuBjC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { KryptosEncryption } from "@lindorm/kryptos";
|
|
2
2
|
import { AesKeyLength } from "@lindorm/types";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const calculateContentEncryptionKeySize: (encryption: KryptosEncryption) => AesKeyLength;
|
|
4
4
|
//# sourceMappingURL=calculate-content-encryption-key-size.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-content-encryption-key-size.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-content-encryption-key-size.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,iCAAiC,eAChC,iBAAiB,KAC5B,YAuBF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calculateContentEncryptionKeySize = void 0;
|
|
4
4
|
const errors_1 = require("../../../errors");
|
|
5
|
-
const
|
|
5
|
+
const calculateContentEncryptionKeySize = (encryption) => {
|
|
6
6
|
switch (encryption) {
|
|
7
7
|
case "A128GCM":
|
|
8
8
|
return 16;
|
|
@@ -20,5 +20,5 @@ const _calculateContentEncryptionKeySize = (encryption) => {
|
|
|
20
20
|
throw new errors_1.AesError("Unsupported encryption", { debug: { encryption } });
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
exports.
|
|
23
|
+
exports.calculateContentEncryptionKeySize = calculateContentEncryptionKeySize;
|
|
24
24
|
//# sourceMappingURL=calculate-content-encryption-key-size.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-content-encryption-key-size.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-content-encryption-key-size.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-content-encryption-key-size.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,iCAAiC,GAAG,CAC/C,UAA6B,EACf,EAAE;IAChB,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ,KAAK,eAAe;YAClB,OAAO,EAAE,CAAC;QAEZ;YACE,MAAM,IAAI,iBAAQ,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC,CAAC;AAzBW,QAAA,iCAAiC,qCAyB5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IKryptos } from "@lindorm/kryptos";
|
|
2
2
|
type KeywrapEncryption = "aes-128-ecb" | "aes-192-ecb" | "aes-256-ecb" | "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const calculateKeyWrapEncryption: (kryptos: IKryptos) => KeywrapEncryption;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=calculate-key-wrap-encryption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-key-wrap-encryption.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,KAAK,iBAAiB,GAClB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-key-wrap-encryption.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,KAAK,iBAAiB,GAClB,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB,eAAO,MAAM,0BAA0B,YAAa,QAAQ,KAAG,iBAgC9D,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.calculateKeyWrapEncryption = void 0;
|
|
4
|
+
const calculateKeyWrapEncryption = (kryptos) => {
|
|
5
5
|
switch (kryptos.algorithm) {
|
|
6
6
|
case "A128KW":
|
|
7
7
|
case "ECDH-ES+A128KW":
|
|
@@ -28,5 +28,5 @@ const _calculateKeyWrapEncryption = (kryptos) => {
|
|
|
28
28
|
throw new Error("Unsupported keywrap encryption");
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
exports.
|
|
31
|
+
exports.calculateKeyWrapEncryption = calculateKeyWrapEncryption;
|
|
32
32
|
//# sourceMappingURL=calculate-key-wrap-encryption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-key-wrap-encryption.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":";;;AAUO,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-key-wrap-encryption.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-encryption.ts"],"names":[],"mappings":";;;AAUO,MAAM,0BAA0B,GAAG,CAAC,OAAiB,EAAqB,EAAE;IACjF,QAAQ,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,QAAQ,CAAC;QACd,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB;YACvB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB,KAAK,WAAW,CAAC;QACjB,KAAK,mBAAmB;YACtB,OAAO,aAAa,CAAC;QAEvB;YACE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACtD,CAAC;AACH,CAAC,CAAC;AAhCW,QAAA,0BAA0B,8BAgCrC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { KryptosAlgorithm } from "@lindorm/kryptos";
|
|
2
2
|
import { AesKeyLength } from "@lindorm/types";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const calculateKeyWrapSize: (algorithm: KryptosAlgorithm) => AesKeyLength;
|
|
4
4
|
//# sourceMappingURL=calculate-key-wrap-size.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-key-wrap-size.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-key-wrap-size.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,oBAAoB,cAAe,gBAAgB,KAAG,YA0BlE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calculateKeyWrapSize = void 0;
|
|
4
4
|
const errors_1 = require("../../../errors");
|
|
5
|
-
const
|
|
5
|
+
const calculateKeyWrapSize = (algorithm) => {
|
|
6
6
|
switch (algorithm) {
|
|
7
7
|
case "A128KW":
|
|
8
8
|
case "A128GCMKW":
|
|
@@ -26,5 +26,5 @@ const _calculateKeyWrapSize = (algorithm) => {
|
|
|
26
26
|
throw new errors_1.AesError("Unsupported algorithm", { debug: { algorithm } });
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
exports.
|
|
29
|
+
exports.calculateKeyWrapSize = calculateKeyWrapSize;
|
|
30
30
|
//# sourceMappingURL=calculate-key-wrap-size.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-key-wrap-size.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-key-wrap-size.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-key-wrap-size.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,oBAAoB,GAAG,CAAC,SAA2B,EAAgB,EAAE;IAChF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,gBAAgB,CAAC;QACtB,KAAK,mBAAmB,CAAC;QACzB,KAAK,oBAAoB;YACvB,OAAO,EAAE,CAAC;QAEZ;YACE,MAAM,IAAI,iBAAQ,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC,CAAC;AA1BW,QAAA,oBAAoB,wBA0B/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IKryptos } from "@lindorm/kryptos";
|
|
2
2
|
import { ShaAlgorithm } from "@lindorm/types";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const calculatePbkdfAlgorithm: (kryptos: IKryptos) => ShaAlgorithm;
|
|
4
4
|
//# sourceMappingURL=calculate-pbkdf-hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-pbkdf-hash.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-pbkdf-hash.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,uBAAuB,YAAa,QAAQ,KAAG,YAc3D,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calculatePbkdfAlgorithm = void 0;
|
|
4
4
|
const errors_1 = require("../../../errors");
|
|
5
|
-
const
|
|
5
|
+
const calculatePbkdfAlgorithm = (kryptos) => {
|
|
6
6
|
switch (kryptos.algorithm) {
|
|
7
7
|
case "PBES2-HS256+A128KW":
|
|
8
8
|
return "SHA256";
|
|
@@ -14,5 +14,5 @@ const _calculatePbkdfAlgorithm = (kryptos) => {
|
|
|
14
14
|
throw new errors_1.AesError("Unsupported PBKDF2 algorithm");
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
exports.
|
|
17
|
+
exports.calculatePbkdfAlgorithm = calculatePbkdfAlgorithm;
|
|
18
18
|
//# sourceMappingURL=calculate-pbkdf-hash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-pbkdf-hash.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-pbkdf-hash.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-pbkdf-hash.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,uBAAuB,GAAG,CAAC,OAAiB,EAAgB,EAAE;IACzE,QAAQ,OAAO,CAAC,SAAS,EAAE,CAAC;QAC1B,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB,KAAK,oBAAoB;YACvB,OAAO,QAAQ,CAAC;QAElB;YACE,MAAM,IAAI,iBAAQ,CAAC,8BAA8B,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC;AAdW,QAAA,uBAAuB,2BAclC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { KryptosAlgorithm } from "@lindorm/kryptos";
|
|
2
2
|
import { ShaAlgorithm } from "@lindorm/types";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const calculateRsaOaepHash: (algorithm: KryptosAlgorithm) => ShaAlgorithm;
|
|
4
4
|
//# sourceMappingURL=calculate-rsa-oaep-hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-rsa-oaep-hash.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-rsa-oaep-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-rsa-oaep-hash.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-rsa-oaep-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,oBAAoB,cAAe,gBAAgB,KAAG,YAmBlE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calculateRsaOaepHash = void 0;
|
|
4
4
|
const errors_1 = require("../../../errors");
|
|
5
|
-
const
|
|
5
|
+
const calculateRsaOaepHash = (algorithm) => {
|
|
6
6
|
switch (algorithm) {
|
|
7
7
|
case "RSA-OAEP":
|
|
8
8
|
return "SHA1";
|
|
@@ -18,5 +18,5 @@ const _calculateRsaOaepHash = (algorithm) => {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
exports.
|
|
21
|
+
exports.calculateRsaOaepHash = calculateRsaOaepHash;
|
|
22
22
|
//# sourceMappingURL=calculate-rsa-oaep-hash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-rsa-oaep-hash.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-rsa-oaep-hash.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,
|
|
1
|
+
{"version":3,"file":"calculate-rsa-oaep-hash.js","sourceRoot":"","sources":["../../../../src/utils/private/calculate/calculate-rsa-oaep-hash.ts"],"names":[],"mappings":";;;AAEA,4CAA2C;AAEpC,MAAM,oBAAoB,GAAG,CAAC,SAA2B,EAAgB,EAAE;IAChF,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,MAAM,CAAC;QAEhB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;QAElB;YACE,MAAM,IAAI,iBAAQ,CAAC,qCAAqC,EAAE;gBACxD,KAAK,EAAE,EAAE,SAAS,EAAE;aACrB,CAAC,CAAC;IACP,CAAC;AACH,CAAC,CAAC;AAnBW,QAAA,oBAAoB,wBAmB/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode-aes-string.d.ts","sourceRoot":"","sources":["../../../src/utils/private/decode-aes-string.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKhD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"decode-aes-string.d.ts","sourceRoot":"","sources":["../../../src/utils/private/decode-aes-string.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKhD,eAAO,MAAM,eAAe,SAAU,MAAM,KAAG,iBAgE9C,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.decodeAesString = void 0;
|
|
4
4
|
const format_1 = require("../../constants/private/format");
|
|
5
5
|
const errors_1 = require("../../errors");
|
|
6
6
|
const regex = /(?<key>[a-z0-9]+)=(?<value>.+)/g;
|
|
7
|
-
const
|
|
7
|
+
const decodeAesString = (data) => {
|
|
8
8
|
const [_, enc, array, content] = data.split("$");
|
|
9
9
|
const encryption = enc;
|
|
10
10
|
const items = array.split(",");
|
|
@@ -22,21 +22,21 @@ const _decodeAesString = (data) => {
|
|
|
22
22
|
const crv = curve;
|
|
23
23
|
const kty = keyType;
|
|
24
24
|
return {
|
|
25
|
-
authTag: Buffer.from(tag, format_1.
|
|
26
|
-
content: Buffer.from(content, format_1.
|
|
25
|
+
authTag: Buffer.from(tag, format_1.B64U),
|
|
26
|
+
content: Buffer.from(content, format_1.B64U),
|
|
27
27
|
encryption: encryption,
|
|
28
28
|
algorithm: alg,
|
|
29
|
-
hkdfSalt: hks ? Buffer.from(hks, format_1.
|
|
30
|
-
initialisationVector: Buffer.from(iv, format_1.
|
|
31
|
-
keyId: Buffer.from(kid, format_1.
|
|
29
|
+
hkdfSalt: hks ? Buffer.from(hks, format_1.B64U) : undefined,
|
|
30
|
+
initialisationVector: Buffer.from(iv, format_1.B64U),
|
|
31
|
+
keyId: Buffer.from(kid, format_1.B64U),
|
|
32
32
|
pbkdfIterations: p2c ? parseInt(p2c, 10) : undefined,
|
|
33
|
-
pbkdfSalt: p2s ? Buffer.from(p2s, format_1.
|
|
33
|
+
pbkdfSalt: p2s ? Buffer.from(p2s, format_1.B64U) : undefined,
|
|
34
34
|
publicEncryptionJwk: crv && x && kty ? { crv, x, y, kty } : undefined,
|
|
35
|
-
publicEncryptionIv: pei ? Buffer.from(pei, format_1.
|
|
36
|
-
publicEncryptionKey: pek ? Buffer.from(pek, format_1.
|
|
37
|
-
publicEncryptionTag: pet ? Buffer.from(pet, format_1.
|
|
35
|
+
publicEncryptionIv: pei ? Buffer.from(pei, format_1.B64U) : undefined,
|
|
36
|
+
publicEncryptionKey: pek ? Buffer.from(pek, format_1.B64U) : undefined,
|
|
37
|
+
publicEncryptionTag: pet ? Buffer.from(pet, format_1.B64U) : undefined,
|
|
38
38
|
version: parseInt(v, 10),
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
exports.
|
|
41
|
+
exports.decodeAesString = decodeAesString;
|
|
42
42
|
//# sourceMappingURL=decode-aes-string.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode-aes-string.js","sourceRoot":"","sources":["../../../src/utils/private/decode-aes-string.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"decode-aes-string.js","sourceRoot":"","sources":["../../../src/utils/private/decode-aes-string.ts"],"names":[],"mappings":";;;AACA,2DAAsD;AACtD,yCAAwC;AAIxC,MAAM,KAAK,GAAG,iCAAiC,CAAC;AAEzC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAqB,EAAE;IACjE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AAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,aAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QAClD,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,aAAI,CAAC;QAC3C,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,aAAI,CAAC;QAC7B,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;QACpD,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,aAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QACnD,mBAAmB,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS;QACrE,kBAAkB,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,aAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QAC5D,mBAAmB,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,aAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QAC7D,mBAAmB,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,aAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QAC7D,OAAO,EAAE,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;KACzB,CAAC;AACJ,CAAC,CAAC;AAhEW,QAAA,eAAe,mBAgE1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CreateCekOptions, CreateCekResult, DecryptCekOptions, DecryptCekResult } from "../../../types/private";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const getDiffieHellmanKeyWrapEncryptionKey: ({ encryption, kryptos, }: CreateCekOptions) => CreateCekResult;
|
|
3
|
+
export declare const getDiffieHellmanKeyWrapDecryptionKey: ({ hkdfSalt, kryptos, publicEncryptionJwk, publicEncryptionIv, publicEncryptionKey, publicEncryptionTag, }: DecryptCekOptions) => DecryptCekResult;
|
|
4
4
|
//# sourceMappingURL=diffie-hellman-key-wrap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diffie-hellman-key-wrap.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/diffie-hellman-key-wrap.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAOhC,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"diffie-hellman-key-wrap.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/diffie-hellman-key-wrap.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAOhC,eAAO,MAAM,oCAAoC,6BAG9C,gBAAgB,KAAG,eAyBrB,CAAC;AAEF,eAAO,MAAM,oCAAoC,8GAO9C,iBAAiB,KAAG,gBAoBtB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getDiffieHellmanKeyWrapDecryptionKey = exports.getDiffieHellmanKeyWrapEncryptionKey = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
5
|
const errors_1 = require("../../../errors");
|
|
6
6
|
const calculate_content_encryption_key_size_1 = require("../calculate/calculate-content-encryption-key-size");
|
|
@@ -8,15 +8,15 @@ const calculate_key_wrap_size_1 = require("../calculate/calculate-key-wrap-size"
|
|
|
8
8
|
const hkdf_1 = require("../key-derivation/hkdf");
|
|
9
9
|
const key_wrap_1 = require("../key-wrap/key-wrap");
|
|
10
10
|
const shared_secret_1 = require("./shared-secret");
|
|
11
|
-
const
|
|
12
|
-
const { publicEncryptionJwk, sharedSecret } = (0, shared_secret_1.
|
|
13
|
-
const cekSize = (0, calculate_content_encryption_key_size_1.
|
|
11
|
+
const getDiffieHellmanKeyWrapEncryptionKey = ({ encryption, kryptos, }) => {
|
|
12
|
+
const { publicEncryptionJwk, sharedSecret } = (0, shared_secret_1.generateSharedSecret)(kryptos);
|
|
13
|
+
const cekSize = (0, calculate_content_encryption_key_size_1.calculateContentEncryptionKeySize)(encryption);
|
|
14
14
|
const contentEncryptionKey = (0, crypto_1.randomBytes)(cekSize);
|
|
15
|
-
const { derivedKey, hkdfSalt } = (0, hkdf_1.
|
|
15
|
+
const { derivedKey, hkdfSalt } = (0, hkdf_1.hkdf)({
|
|
16
16
|
derivationKey: sharedSecret,
|
|
17
|
-
keyLength: (0, calculate_key_wrap_size_1.
|
|
17
|
+
keyLength: (0, calculate_key_wrap_size_1.calculateKeyWrapSize)(kryptos.algorithm),
|
|
18
18
|
});
|
|
19
|
-
const { publicEncryptionKey, publicEncryptionIv, publicEncryptionTag } = (0, key_wrap_1.
|
|
19
|
+
const { publicEncryptionKey, publicEncryptionIv, publicEncryptionTag } = (0, key_wrap_1.keyWrap)({
|
|
20
20
|
contentEncryptionKey,
|
|
21
21
|
kryptos,
|
|
22
22
|
keyEncryptionKey: derivedKey,
|
|
@@ -30,18 +30,18 @@ const _getDiffieHellmanKeyWrapEncryptionKey = ({ encryption, kryptos, }) => {
|
|
|
30
30
|
publicEncryptionTag,
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
exports.
|
|
34
|
-
const
|
|
33
|
+
exports.getDiffieHellmanKeyWrapEncryptionKey = getDiffieHellmanKeyWrapEncryptionKey;
|
|
34
|
+
const getDiffieHellmanKeyWrapDecryptionKey = ({ hkdfSalt, kryptos, publicEncryptionJwk, publicEncryptionIv, publicEncryptionKey, publicEncryptionTag, }) => {
|
|
35
35
|
if (!publicEncryptionKey) {
|
|
36
36
|
throw new errors_1.AesError("Missing publicEncryptionKey");
|
|
37
37
|
}
|
|
38
|
-
const sharedSecret = (0, shared_secret_1.
|
|
39
|
-
const { derivedKey } = (0, hkdf_1.
|
|
38
|
+
const sharedSecret = (0, shared_secret_1.calculateSharedSecret)({ kryptos, publicEncryptionJwk });
|
|
39
|
+
const { derivedKey } = (0, hkdf_1.hkdf)({
|
|
40
40
|
derivationKey: sharedSecret,
|
|
41
41
|
hkdfSalt,
|
|
42
|
-
keyLength: (0, calculate_key_wrap_size_1.
|
|
42
|
+
keyLength: (0, calculate_key_wrap_size_1.calculateKeyWrapSize)(kryptos.algorithm),
|
|
43
43
|
});
|
|
44
|
-
return (0, key_wrap_1.
|
|
44
|
+
return (0, key_wrap_1.keyUnwrap)({
|
|
45
45
|
keyEncryptionKey: derivedKey,
|
|
46
46
|
kryptos,
|
|
47
47
|
publicEncryptionIv,
|
|
@@ -49,5 +49,5 @@ const _getDiffieHellmanKeyWrapDecryptionKey = ({ hkdfSalt, kryptos, publicEncryp
|
|
|
49
49
|
publicEncryptionTag,
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
-
exports.
|
|
52
|
+
exports.getDiffieHellmanKeyWrapDecryptionKey = getDiffieHellmanKeyWrapDecryptionKey;
|
|
53
53
|
//# sourceMappingURL=diffie-hellman-key-wrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diffie-hellman-key-wrap.js","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/diffie-hellman-key-wrap.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AACrC,4CAA2C;AAO3C,
|
|
1
|
+
{"version":3,"file":"diffie-hellman-key-wrap.js","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/diffie-hellman-key-wrap.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;A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AAA,WAAI,EAAC;QAC1B,aAAa,EAAE,YAAY;QAC3B,QAAQ;QACR,SAAS,EAAE,IAAA,8CAAoB,EAAC,OAAO,CAAC,SAAS,CAAC;KACnD,CAAC,CAAC;IAEH,OAAO,IAAA,oBAAS,EAAC;QACf,gBAAgB,EAAE,UAAU;QAC5B,OAAO;QACP,kBAAkB;QAClB,mBAAmB;QACnB,mBAAmB;KACpB,CAAC,CAAC;AACL,CAAC,CAAC;AA3BW,QAAA,oCAAoC,wCA2B/C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CreateCekOptions, CreateCekResult, DecryptCekOptions, DecryptCekResult } from "../../../types/private";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const getDiffieHellmanEncryptionKey: ({ encryption, kryptos, }: CreateCekOptions) => CreateCekResult;
|
|
3
|
+
export declare const getDiffieHellmanDecryptionKey: ({ encryption, hkdfSalt, kryptos, publicEncryptionJwk, }: DecryptCekOptions) => DecryptCekResult;
|
|
4
4
|
//# sourceMappingURL=diffie-hellman.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diffie-hellman.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/diffie-hellman.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAKhC,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"diffie-hellman.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/diffie-hellman.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAKhC,eAAO,MAAM,6BAA6B,6BAGvC,gBAAgB,KAAG,eAcrB,CAAC;AAEF,eAAO,MAAM,6BAA6B,4DAKvC,iBAAiB,KAAG,gBAkBtB,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getDiffieHellmanDecryptionKey = exports.getDiffieHellmanEncryptionKey = void 0;
|
|
4
4
|
const kryptos_1 = require("@lindorm/kryptos");
|
|
5
5
|
const errors_1 = require("../../../errors");
|
|
6
6
|
const calculate_content_encryption_key_size_1 = require("../calculate/calculate-content-encryption-key-size");
|
|
7
7
|
const hkdf_1 = require("../key-derivation/hkdf");
|
|
8
8
|
const shared_secret_1 = require("./shared-secret");
|
|
9
|
-
const
|
|
10
|
-
const { publicEncryptionJwk, sharedSecret } = (0, shared_secret_1.
|
|
11
|
-
const keyLength = (0, calculate_content_encryption_key_size_1.
|
|
12
|
-
const { derivedKey, hkdfSalt } = (0, hkdf_1.
|
|
9
|
+
const getDiffieHellmanEncryptionKey = ({ encryption, kryptos, }) => {
|
|
10
|
+
const { publicEncryptionJwk, sharedSecret } = (0, shared_secret_1.generateSharedSecret)(kryptos);
|
|
11
|
+
const keyLength = (0, calculate_content_encryption_key_size_1.calculateContentEncryptionKeySize)(encryption);
|
|
12
|
+
const { derivedKey, hkdfSalt } = (0, hkdf_1.hkdf)({
|
|
13
13
|
derivationKey: sharedSecret,
|
|
14
14
|
keyLength,
|
|
15
15
|
});
|
|
@@ -19,22 +19,22 @@ const _getDiffieHellmanEncryptionKey = ({ encryption, kryptos, }) => {
|
|
|
19
19
|
publicEncryptionJwk,
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
exports.
|
|
23
|
-
const
|
|
22
|
+
exports.getDiffieHellmanEncryptionKey = getDiffieHellmanEncryptionKey;
|
|
23
|
+
const getDiffieHellmanDecryptionKey = ({ encryption, hkdfSalt, kryptos, publicEncryptionJwk, }) => {
|
|
24
24
|
if (!kryptos_1.Kryptos.isEc(kryptos) && !kryptos_1.Kryptos.isOkp(kryptos)) {
|
|
25
25
|
throw new errors_1.AesError("Invalid kryptos type");
|
|
26
26
|
}
|
|
27
27
|
if (!publicEncryptionJwk) {
|
|
28
28
|
throw new errors_1.AesError("Missing publicEncryptionJwk");
|
|
29
29
|
}
|
|
30
|
-
const sharedSecret = (0, shared_secret_1.
|
|
31
|
-
const keyLength = (0, calculate_content_encryption_key_size_1.
|
|
32
|
-
const { derivedKey } = (0, hkdf_1.
|
|
30
|
+
const sharedSecret = (0, shared_secret_1.calculateSharedSecret)({ kryptos, publicEncryptionJwk });
|
|
31
|
+
const keyLength = (0, calculate_content_encryption_key_size_1.calculateContentEncryptionKeySize)(encryption);
|
|
32
|
+
const { derivedKey } = (0, hkdf_1.hkdf)({
|
|
33
33
|
derivationKey: sharedSecret,
|
|
34
34
|
hkdfSalt,
|
|
35
35
|
keyLength,
|
|
36
36
|
});
|
|
37
37
|
return { contentEncryptionKey: derivedKey };
|
|
38
38
|
};
|
|
39
|
-
exports.
|
|
39
|
+
exports.getDiffieHellmanDecryptionKey = getDiffieHellmanDecryptionKey;
|
|
40
40
|
//# sourceMappingURL=diffie-hellman.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diffie-hellman.js","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/diffie-hellman.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAC3C,4CAA2C;AAO3C,
|
|
1
|
+
{"version":3,"file":"diffie-hellman.js","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/diffie-hellman.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAC3C,4CAA2C;AAO3C,8GAAuG;AACvG,iDAA8C;AAC9C,mDAA8E;AAEvE,MAAM,6BAA6B,GAAG,CAAC,EAC5C,UAAU,EACV,OAAO,GACU,EAAmB,EAAE;IACtC,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAE,GAAG,IAAA,oCAAoB,EAAC,OAAO,CAAC,CAAC;IAC5E,MAAM,SAAS,GAAG,IAAA,yEAAiC,EAAC,UAAU,CAAC,CAAC;IAEhE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAA,WAAI,EAAC;QACpC,aAAa,EAAE,YAAY;QAC3B,SAAS;KACV,CAAC,CAAC;IAEH,OAAO;QACL,oBAAoB,EAAE,UAAU;QAChC,QAAQ;QACR,mBAAmB;KACpB,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,6BAA6B,iCAiBxC;AAEK,MAAM,6BAA6B,GAAG,CAAC,EAC5C,UAAU,EACV,QAAQ,EACR,OAAO,EACP,mBAAmB,GACD,EAAoB,EAAE;IACxC,IAAI,CAAC,iBAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,iBAAQ,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,MAAM,IAAI,iBAAQ,CAAC,6BAA6B,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,YAAY,GAAG,IAAA,qCAAqB,EAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAC7E,MAAM,SAAS,GAAG,IAAA,yEAAiC,EAAC,UAAU,CAAC,CAAC;IAEhE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,WAAI,EAAC;QAC1B,aAAa,EAAE,YAAY;QAC3B,QAAQ;QACR,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,CAAC;AAC9C,CAAC,CAAC;AAvBW,QAAA,6BAA6B,iCAuBxC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { IKryptos } from "@lindorm/kryptos";
|
|
3
2
|
import { PublicEncryptionJwk } from "../../../types";
|
|
4
3
|
import { DecryptCekOptions } from "../../../types/private";
|
|
@@ -7,7 +6,7 @@ type GenerateResult = {
|
|
|
7
6
|
sharedSecret: Buffer;
|
|
8
7
|
};
|
|
9
8
|
type CalculateSharedSecretOptions = Pick<DecryptCekOptions, "kryptos" | "publicEncryptionJwk">;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
9
|
+
export declare const generateSharedSecret: (kryptos: IKryptos) => GenerateResult;
|
|
10
|
+
export declare const calculateSharedSecret: ({ kryptos, publicEncryptionJwk, }: CalculateSharedSecretOptions) => Buffer;
|
|
12
11
|
export {};
|
|
13
12
|
//# sourceMappingURL=shared-secret.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-secret.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/shared-secret.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared-secret.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/shared-secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAW,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,KAAK,cAAc,GAAG;IACpB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,4BAA4B,GAAG,IAAI,CACtC,iBAAiB,EACjB,SAAS,GAAG,qBAAqB,CAClC,CAAC;AAeF,eAAO,MAAM,oBAAoB,YAAa,QAAQ,KAAG,cA4BxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,sCAG/B,4BAA4B,KAAG,MAyBjC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calculateSharedSecret = exports.generateSharedSecret = void 0;
|
|
4
4
|
const kryptos_1 = require("@lindorm/kryptos");
|
|
5
5
|
const crypto_1 = require("crypto");
|
|
6
6
|
const errors_1 = require("../../../errors");
|
|
7
|
-
const
|
|
7
|
+
const generateKryptos = (kryptos) => {
|
|
8
8
|
if (!kryptos_1.Kryptos.isEc(kryptos) && !kryptos_1.Kryptos.isOkp(kryptos)) {
|
|
9
9
|
throw new errors_1.AesError("Invalid kryptos type");
|
|
10
10
|
}
|
|
@@ -15,8 +15,8 @@ const _generateKryptos = (kryptos) => {
|
|
|
15
15
|
use: "enc",
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
const
|
|
19
|
-
const pek =
|
|
18
|
+
const generateSharedSecret = (kryptos) => {
|
|
19
|
+
const pek = generateKryptos(kryptos);
|
|
20
20
|
const der = kryptos.export("der");
|
|
21
21
|
const sender = pek.export("der");
|
|
22
22
|
if (!sender.privateKey) {
|
|
@@ -40,8 +40,8 @@ const _generateSharedSecret = (kryptos) => {
|
|
|
40
40
|
sharedSecret,
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
-
exports.
|
|
44
|
-
const
|
|
43
|
+
exports.generateSharedSecret = generateSharedSecret;
|
|
44
|
+
const calculateSharedSecret = ({ kryptos, publicEncryptionJwk, }) => {
|
|
45
45
|
if (!publicEncryptionJwk) {
|
|
46
46
|
throw new errors_1.AesError("Missing publicEncryptionJwk");
|
|
47
47
|
}
|
|
@@ -64,5 +64,5 @@ const _calculateSharedSecret = ({ kryptos, publicEncryptionJwk, }) => {
|
|
|
64
64
|
}),
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
-
exports.
|
|
67
|
+
exports.calculateSharedSecret = calculateSharedSecret;
|
|
68
68
|
//# sourceMappingURL=shared-secret.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-secret.js","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/shared-secret.ts"],"names":[],"mappings":";;;AAAA,8CAAqD;AACrD,mCAA0E;AAC1E,4CAA2C;AAc3C,MAAM,
|
|
1
|
+
{"version":3,"file":"shared-secret.js","sourceRoot":"","sources":["../../../../src/utils/private/diffie-hellman/shared-secret.ts"],"names":[],"mappings":";;;AAAA,8CAAqD;AACrD,mCAA0E;AAC1E,4CAA2C;AAc3C,MAAM,eAAe,GAAG,CAAC,OAAiB,EAAY,EAAE;IACtD,IAAI,CAAC,iBAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,iBAAQ,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,iBAAO,CAAC,QAAQ,CAAC;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,EAAE,KAAK;KACJ,CAAC,CAAC;AACZ,CAAC,CAAC;AAEK,MAAM,oBAAoB,GAAG,CAAC,OAAiB,EAAkB,EAAE;IACxE,MAAM,GAAG,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,IAAI,iBAAQ,CAAC,+BAA+B,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,YAAY,GAAG,IAAA,sBAAa,EAAC;QACjC,UAAU,EAAE,IAAA,yBAAgB,EAAC;YAC3B,GAAG,EAAE,MAAM,CAAC,UAAU;YACtB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,OAAO;SACd,CAAC;QACF,SAAS,EAAE,IAAA,wBAAe,EAAC;YACzB,GAAG,EAAE,GAAG,CAAC,SAAS;YAClB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,MAAM;SACb,CAAC;KAC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1,3 +1,3 @@
|
|
|
1
1
|
import { AesEncryptionData } from "../../types";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const encodeAesString: ({ algorithm, authTag, content, encryption, hkdfSalt, initialisationVector, keyId, pbkdfIterations, pbkdfSalt, publicEncryptionIv, publicEncryptionJwk, publicEncryptionKey, publicEncryptionTag, version, }: AesEncryptionData) => string;
|
|
3
3
|
//# sourceMappingURL=encode-aes-string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode-aes-string.d.ts","sourceRoot":"","sources":["../../../src/utils/private/encode-aes-string.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"encode-aes-string.d.ts","sourceRoot":"","sources":["../../../src/utils/private/encode-aes-string.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,eAAO,MAAM,eAAe,gNAezB,iBAAiB,KAAG,MAgCtB,CAAC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.encodeAesString = void 0;
|
|
4
4
|
const utils_1 = require("@lindorm/utils");
|
|
5
5
|
const format_1 = require("../../constants/private/format");
|
|
6
|
-
const
|
|
6
|
+
const encodeAesString = ({ algorithm, authTag, content, encryption, hkdfSalt, initialisationVector, keyId, pbkdfIterations, pbkdfSalt, publicEncryptionIv, publicEncryptionJwk, publicEncryptionKey, publicEncryptionTag, version, }) => {
|
|
7
7
|
const values = (0, utils_1.removeEmpty)({
|
|
8
8
|
v: version.toString(),
|
|
9
|
-
kid: keyId.toString(format_1.
|
|
9
|
+
kid: keyId.toString(format_1.B64U),
|
|
10
10
|
alg: algorithm,
|
|
11
|
-
iv: initialisationVector.toString(format_1.
|
|
12
|
-
tag: authTag.toString(format_1.
|
|
13
|
-
hks: hkdfSalt?.toString(format_1.
|
|
11
|
+
iv: initialisationVector.toString(format_1.B64U),
|
|
12
|
+
tag: authTag.toString(format_1.B64U),
|
|
13
|
+
hks: hkdfSalt?.toString(format_1.B64U),
|
|
14
14
|
p2c: pbkdfIterations?.toString(),
|
|
15
|
-
p2s: pbkdfSalt?.toString(format_1.
|
|
16
|
-
pei: publicEncryptionIv?.toString(format_1.
|
|
17
|
-
pek: publicEncryptionKey?.toString(format_1.
|
|
18
|
-
pet: publicEncryptionTag?.toString(format_1.
|
|
15
|
+
p2s: pbkdfSalt?.toString(format_1.B64U),
|
|
16
|
+
pei: publicEncryptionIv?.toString(format_1.B64U),
|
|
17
|
+
pek: publicEncryptionKey?.toString(format_1.B64U),
|
|
18
|
+
pet: publicEncryptionTag?.toString(format_1.B64U),
|
|
19
19
|
crv: publicEncryptionJwk?.crv,
|
|
20
20
|
kty: publicEncryptionJwk?.kty,
|
|
21
21
|
x: publicEncryptionJwk?.x,
|
|
@@ -23,8 +23,8 @@ const _encodeAesString = ({ algorithm, authTag, content, encryption, hkdfSalt, i
|
|
|
23
23
|
});
|
|
24
24
|
const array = Object.entries(values).map(([key, value]) => `${key}=${value}`);
|
|
25
25
|
const str = array.join(",");
|
|
26
|
-
const cnt = content.toString(format_1.
|
|
26
|
+
const cnt = content.toString(format_1.B64U);
|
|
27
27
|
return `$${encryption}$${str}$${cnt}$`;
|
|
28
28
|
};
|
|
29
|
-
exports.
|
|
29
|
+
exports.encodeAesString = encodeAesString;
|
|
30
30
|
//# sourceMappingURL=encode-aes-string.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode-aes-string.js","sourceRoot":"","sources":["../../../src/utils/private/encode-aes-string.ts"],"names":[],"mappings":";;;AAAA,0CAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"encode-aes-string.js","sourceRoot":"","sources":["../../../src/utils/private/encode-aes-string.ts"],"names":[],"mappings":";;;AAAA,0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G,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAI,CAAC,CAAC;IAEnC,OAAO,IAAI,UAAU,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC;AACzC,CAAC,CAAC;AA/CW,QAAA,eAAe,mBA+C1B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DecryptCekOptions, DecryptCekResult } from "../../../types/private";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const getDecryptionKey: (options: DecryptCekOptions) => DecryptCekResult;
|
|
3
3
|
//# sourceMappingURL=get-decryption-key.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-decryption-key.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/get-key/get-decryption-key.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM7E,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"get-decryption-key.d.ts","sourceRoot":"","sources":["../../../../src/utils/private/get-key/get-decryption-key.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM7E,eAAO,MAAM,gBAAgB,YAAa,iBAAiB,KAAG,gBAmB7D,CAAC"}
|