A legacy application (ColdFusion) is using Blowfish/CBC/PKCS5Padding
encryption. How can we encrypt and decrypt this data using the BouncyCastle lib?
For other fields, encrypted in ColdFusion using this:
encrypt( data, key, 'BLOWFISH', 'HEX')
We use this code
BlowfishEngine engine = new BlowfishEngine();
PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(engine);
cipher.Init(false, new KeyParameter(Convert.FromBase64String(keyString)));
byte[] out1 = Hex.Decode(name);
byte[] out2 = new byte[cipher.GetOutputSize(out1.Length)];
int len2 = cipher.ProcessBytes(out1, 0, out1.Length, out2, 0);
cipher.DoFinal(out2, len2);
return Encoding.UTF8.GetString(out2);
The problem is how to decrypt something, encrypted in ColdFusion like this:
encrypt( data, Key, "Blowfish/CBC/PKCS5Padding", "base64", IV )