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") }