I have a Base64 encoded value that is AES CBC encrypted with a null IV. I tried all sorts of combinations, but the original string is not comming back. I can decrypt fine with AESManaged, but the target machine is Windows Server 2000, so we'll go for the Chilkat Chilkat.Crypt2 (It's a classic asp application).
This is what I have so far. (Key = "6F2F108EB7F65452A1EE3E5B007103ED" Testvalue = "Td6cGqFDvaKQes/ewPHX+Ygwl5IipdnyJf9hKiZbNv8="
What am I doing wrong?
Your key is in hex, and the data you are trying to decrypt is the Base64 string representation of the encrypted bytes. Chilkat makes it easy to use the encoded strings directly, so you don't have to go through the pain and complexity of dealing with byte arrays.
With this solution, you can discard the functions for converting hex strings to byte arrays:
crypt.CryptAlgorithm = "aes" crypt.CipherMode = "cbc" crypt.KeyLength = 128 crypt.SetEncodedIV "0000000000000000", "hex" crypt.SetEncodedKey "6F2F108EB7F65452A1EE3E5B007103ED", "hex" crypt.EncodingMode = "base64" dim outStr as String outStr = crypt.DecryptStringENC("Td6cGqFDvaKQes/ewPHX+Ygwl5IipdnyJf9hKiZbNv8=")
Also, see this for a more detailed description of EncryptStringENC and DecryptStringENC: http://www.cknotes.com/?p=504 (The discussion at this web page pertains to any programming language)
answered Oct 11 '13 at 08:24