I have a project that provides the following encryption rules for a 24-byte data block.
1) Cryptography should be performed using the complete DES MAC algorithm, as defined in 9797-1 as MAC algorithm 3 with output conversion 3 without truncation and with DES in CBC mode as a block, the cipher with ICV is set to zero. The last 8 bytes of the encrypted data make up the value we need.
The program says that the encryption made is incorrect. Are there any other things I need to do to fit the above specification?
The data is a 24-byte value, and the encryption output should be 8 bytes, I suppose (according to the specification). I get all 24 bytes as output :(
I wrote the following code to achieve the specified specification:
des.KeySize = 128; des.Key = ParseHex(key); des.Mode = CipherMode.CBC; des.Padding = PaddingMode.None; ICryptoTransform ic = des.CreateEncryptor(); CryptoOutput = ic.TransformFinalBlock(CryptoOutput, 0, 24);
I also tried this:
MACTripleDES des = new MACTripleDES(ParseHex(key)); byte[] CDCryptp = des.ComputeHash(CryptoOutput);
source share