From 3eb1af0278706d4b016d58d21e1f3f8e4bac03ff Mon Sep 17 00:00:00 2001 From: Francisco Pombal Date: Mon, 16 Sep 2024 15:36:57 +0100 Subject: [PATCH] fix: DES/Triple DES - misleading error messages Fixes https://github.com/gchq/CyberChef/issues/1843. --- src/core/operations/DESDecrypt.mjs | 5 ++--- src/core/operations/DESEncrypt.mjs | 5 ++--- src/core/operations/TripleDESDecrypt.mjs | 5 ++--- src/core/operations/TripleDESEncrypt.mjs | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/core/operations/DESDecrypt.mjs b/src/core/operations/DESDecrypt.mjs index 856aa06580..4b1ab40ee8 100644 --- a/src/core/operations/DESDecrypt.mjs +++ b/src/core/operations/DESDecrypt.mjs @@ -22,7 +22,7 @@ class DESDecrypt extends Operation { this.name = "DES Decrypt"; this.module = "Ciphers"; - this.description = "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.

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

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used as a default."; + this.description = "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.

Key: DES uses a key length of 8 bytes (64 bits).

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used as a default."; this.infoURL = "https://wikipedia.org/wiki/Data_Encryption_Standard"; this.inputType = "string"; this.outputType = "string"; @@ -72,8 +72,7 @@ class DESDecrypt extends Operation { 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).`); +DES uses a key length of 8 bytes (64 bits).`); } if (iv.length !== 8 && mode !== "ECB") { throw new OperationError(`Invalid IV length: ${iv.length} bytes diff --git a/src/core/operations/DESEncrypt.mjs b/src/core/operations/DESEncrypt.mjs index 9472abe87f..28d6202a64 100644 --- a/src/core/operations/DESEncrypt.mjs +++ b/src/core/operations/DESEncrypt.mjs @@ -22,7 +22,7 @@ class DESEncrypt extends Operation { this.name = "DES Encrypt"; this.module = "Ciphers"; - this.description = "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.

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

You can generate a password-based key using one of the KDF operations.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used."; + this.description = "DES is a previously dominant algorithm for encryption, and was published as an official U.S. Federal Information Processing Standard (FIPS). It is now considered to be insecure due to its small key size.

Key: DES uses a key length of 8 bytes (64 bits).

You can generate a password-based key using one of the KDF operations.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used."; this.infoURL = "https://wikipedia.org/wiki/Data_Encryption_Standard"; this.inputType = "string"; this.outputType = "string"; @@ -70,8 +70,7 @@ class DESEncrypt extends Operation { 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).`); +DES uses a key length of 8 bytes (64 bits).`); } if (iv.length !== 8 && mode !== "ECB") { throw new OperationError(`Invalid IV length: ${iv.length} bytes diff --git a/src/core/operations/TripleDESDecrypt.mjs b/src/core/operations/TripleDESDecrypt.mjs index 8487509f85..927600de68 100644 --- a/src/core/operations/TripleDESDecrypt.mjs +++ b/src/core/operations/TripleDESDecrypt.mjs @@ -22,7 +22,7 @@ class TripleDESDecrypt extends Operation { this.name = "Triple DES Decrypt"; this.module = "Ciphers"; - this.description = "Triple DES applies DES three times to each block to increase key size.

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

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used as a default."; + this.description = "Triple DES applies DES three times to each block to increase key size.

Key: Triple DES uses a key length of 24 bytes (192 bits).

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used as a default."; this.infoURL = "https://wikipedia.org/wiki/Triple_DES"; this.inputType = "string"; this.outputType = "string"; @@ -73,8 +73,7 @@ class TripleDESDecrypt extends Operation { if (key.length !== 24 && key.length !== 16) { throw new OperationError(`Invalid key length: ${key.length} bytes -Triple DES uses a key length of 24 bytes (192 bits). -DES uses a key length of 8 bytes (64 bits).`); +Triple DES uses a key length of 24 bytes (192 bits).`); } if (iv.length !== 8 && mode !== "ECB") { throw new OperationError(`Invalid IV length: ${iv.length} bytes diff --git a/src/core/operations/TripleDESEncrypt.mjs b/src/core/operations/TripleDESEncrypt.mjs index 720d155d37..b4a218d000 100644 --- a/src/core/operations/TripleDESEncrypt.mjs +++ b/src/core/operations/TripleDESEncrypt.mjs @@ -22,7 +22,7 @@ class TripleDESEncrypt extends Operation { this.name = "Triple DES Encrypt"; this.module = "Ciphers"; - this.description = "Triple DES applies DES three times to each block to increase key size.

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

You can generate a password-based key using one of the KDF operations.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used."; + this.description = "Triple DES applies DES three times to each block to increase key size.

Key: Triple DES uses a key length of 24 bytes (192 bits).

You can generate a password-based key using one of the KDF operations.

IV: The Initialization Vector should be 8 bytes long. If not entered, it will default to 8 null bytes.

Padding: In CBC and ECB mode, PKCS#7 padding will be used."; this.infoURL = "https://wikipedia.org/wiki/Triple_DES"; this.inputType = "string"; this.outputType = "string"; @@ -72,8 +72,7 @@ class TripleDESEncrypt extends Operation { if (key.length !== 24 && key.length !== 16) { throw new OperationError(`Invalid key length: ${key.length} bytes -Triple DES uses a key length of 24 bytes (192 bits). -DES uses a key length of 8 bytes (64 bits).`); +Triple DES uses a key length of 24 bytes (192 bits).`); } if (iv.length !== 8 && mode !== "ECB") { throw new OperationError(`Invalid IV length: ${iv.length} bytes