{"record":{"id":"7992332ceda06ff4","repo":"gchq/CyberChef","slug":"unable-to-decrypt-input-with-these-parameters-799233","errorCode":null,"errorMessage":"Unable to decrypt input with these parameters.","messagePattern":"Unable to decrypt input with these parameters\\.","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/BlowfishDecrypt.mjs","lineNumber":93,"sourceCode":"\nBlowfish's key length needs to be between 4 and 56 bytes (32-448 bits).`);\n        }\n\n        if (mode !== \"ECB\" && iv.length !== 8) {\n            throw new OperationError(`Invalid IV length: ${iv.length} bytes. Expected 8 bytes.`);\n        }\n\n        input = Utils.convertToByteString(input, inputType);\n\n        const decipher = Blowfish.createDecipher(key, mode);\n        decipher.start({iv: iv});\n        decipher.update(forge.util.createBuffer(input));\n        const result = decipher.finish();\n\n        if (result) {\n            return outputType === \"Hex\" ? decipher.output.toHex() : decipher.output.getBytes();\n        } else {\n            throw new OperationError(\"Unable to decrypt input with these parameters.\");\n        }\n    }\n\n}\n\nexport default BlowfishDecrypt;\n","sourceCodeStart":75,"sourceCodeEnd":100,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/BlowfishDecrypt.mjs#L75-L100","documentation":"After feeding the ciphertext through forge's Blowfish decipher, decipher.finish() returns false when the cipher cannot finalize correctly - typically because the input is not a valid multiple of the 8-byte block size, the padding cannot be removed, or the key/IV/mode do not match the encryption parameters. The operation interprets this as unrecoverable decryption failure.","triggerScenarios":"Calling BlowfishDecrypt.run where decipher.finish() returns false: input length not a multiple of 8 bytes, wrong padding, mismatched key/IV/mode versus the original encryption, or corrupted/truncated ciphertext.","commonSituations":"Decrypting with a different mode or IV than was used to encrypt; feeding ciphertext that lost bytes in transit; hex/base64 decoding mismatch; using ECB-padded data in CBC mode.","solutions":["Confirm the input byte length is a positive multiple of 8 (Blowfish block size).","Match key, IV, and mode exactly to those used during encryption.","Re-verify the inputType option (Hex/Base64) reflects the actual ciphertext encoding.","If data may be truncated, reject or retransmit rather than retrying the same parameters."],"exampleFix":"// before\nmode='CBC', ciphertext '00112233' (4 bytes)\n// after\nmode='CBC', ciphertext '0011223344556677' (8 bytes)","handlingStrategy":"try-catch","validationCode":"if (input.length % 8 !== 0) throw new Error('Ciphertext must be a multiple of 8 bytes');","typeGuard":null,"tryCatchPattern":"try { blowfishDecrypt.run(input, args); }\ncatch (e) { if (/Unable to decrypt/.test(e.message)) { /* verify key/IV/mode, re-fetch ciphertext */ } else throw e; }","preventionTips":["Keep the key, IV, and mode in lockstep with the encryption side.","Validate ciphertext is block-aligned before decrypting.","Treat a finish() failure as wrong parameters, not a transient retry candidate."],"tags":["crypto","blowfish","decryption-failure","block-size"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}