gchq/CyberChef · error · OperationError
Undefined encryption algorithm
Error message
Undefined encryption algorithm
What it means
The CMAC operation's algorithm switch only handles 'AES' and 'Triple DES'. Any other value for args[1] (algo) falls through to the default case and throws, since no block-cipher configuration is defined for it.
Source
Thrown at src/core/operations/CMAC.mjs:77
}
return {
"algorithm": "AES-ECB",
"key": key,
"blockSize": 16,
"Rb": new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x87]),
};
case "Triple DES":
if (key.length !== 16 && key.length !== 24) {
throw new OperationError("The key for Triple DES must be 16 or 24 bytes (currently " + key.length + " bytes)");
}
return {
"algorithm": "3DES-ECB",
"key": key.length === 16 ? key + key.substring(0, 8) : key,
"blockSize": 8,
"Rb": new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0x1b]),
};
default:
throw new OperationError("Undefined encryption algorithm");
}
})();
const xor = function(a, b, out) {
if (!out) out = new Uint8Array(a.length);
for (let i = 0; i < a.length; i++) {
out[i] = a[i] ^ b[i];
}
return out;
};
const leftShift1 = function(a) {
const out = new Uint8Array(a.length);
let carry = 0;
for (let i = a.length - 1; i >= 0; i--) {
out[i] = (a[i] << 1) | carry;
carry = a[i] >> 7;
}View on GitHub (pinned to 4290ea7539)
Solutions
- Set algo to exactly 'AES' or 'Triple DES'.
- If you need another algorithm, pick a different MAC operation (e.g. HMAC).
- Validate the algorithm against the allowed set in the UI before running.
Example fix
// before algo = 'AES-128' // after algo = 'AES'
Defensive patterns
Strategy: validation
Validate before calling
if (!['AES', 'Triple DES'].includes(algo)) throw new Error('CMAC algo must be AES or Triple DES'); Type guard
function isSupportedCmacAlgo(a) { return a === 'AES' || a === 'Triple DES'; } Prevention
- Restrict the algorithm dropdown to AES and Triple DES.
- For other primitives use the appropriate MAC operation.
- Validate against the allowed set before running.
When it happens
Trigger: Calling CMAC.run with args[1] set to a value other than 'AES' or 'Triple DES' (e.g. a typo, 'DES', 'AES-128', or a localized string).
Common situations: Dropdown/value mismatch after an upgrade; user-typed algorithm name; recipe serialized with a stale or unsupported algorithm identifier.
Related errors
- The key for AES must be either 16, 24, or 32 bytes (currentl
- The key for Triple DES must be 16 or 24 bytes (currently ${k
- Letter ${letter} is not included in LS47
- Unknown padding type: ${padding}
- Invalid key length: ${key.length} bytes The following algor
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/ce8f9884f532ed9b.
Report an issue: GitHub.