gchq / CyberChef

The Cyber Swiss Army Knife - a web app for encryption, encoding, compression and data analysis
https://gchq.github.io/CyberChef
Apache License 2.0
27.35k stars 3.09k forks source link

Bug report: DES Decrypt/Encrypt not wokring with 24 bytes key #1843

Open Sabadon opened 3 weeks ago

Sabadon commented 3 weeks ago

Describe the bug Trying to use a triple-length key I get the error: Invalid key length: 24 bytes

DES uses a key length of 8 bytes (64 bits). Triple DES uses a key length of 24 bytes (192 bits).

To Reproduce Link to recipe

Expected behaviour No error, and an attempt to decrypt/encrypt the input

Additional context I looked at the code and it only checks for length 8 bytes

if (key.length !== 8) {
            throw new OperationError(`Invalid key length: ${key.length} bytes

DES uses a key length of 8 bytes (64 bits).
Triple DES uses a key length of 24 bytes (192 bits).`);
}
Sabadon commented 3 weeks ago

I found a recipe for Triple DES Decrypt, then in DES Decrypt you need to at least change the error message, which is misleading.