From 986f0d5354d1651f5c6c197ed450f357510dbde7 Mon Sep 17 00:00:00 2001 From: Alex Kaminskii Date: Wed, 12 Oct 2022 14:49:17 +0200 Subject: [PATCH] fix(player): fileKey is 16-sym hex --- frontend/app/player/MessageDistributor/network/crypto.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/app/player/MessageDistributor/network/crypto.ts b/frontend/app/player/MessageDistributor/network/crypto.ts index 754d449f7..c6150f6cc 100644 --- a/frontend/app/player/MessageDistributor/network/crypto.ts +++ b/frontend/app/player/MessageDistributor/network/crypto.ts @@ -14,7 +14,10 @@ function truncPadding(padded: Uint8Array): Uint8Array { } export function decryptSessionBytes(cypher: Uint8Array, keyString: string): Promise { - const [hexKey, hexIV] = keyString.split(",") + if (keyString.length !== 16) { + return Promise.reject("Wrong key string format") + } + const [hexKey, hexIV] = keyString.match(/.{8}/g) if (!is16BitHex(hexIV) || !is16BitHex(hexKey)) { return Promise.reject("Wrong key/iv pair") }