This content has been marked as final. Show 5 replies
Do you need to use a pre-specified key, or can you use the one generated by the generateSecretKey() call? If you have an existing key you need to use, have you tried passing it into the encrypt() function using toBase64() to convert it to base 64?
#encrypt("some text to encrypt", toBase64(myDesKey), "DES")#
Michael, Thanks you for your input.
I do need to use a pre-specified key. I tried your suggestion and converted it to Base64 at which point it complained about the key length being invalid for this encryption. It then suggested that I use the GenerateSecretKey function.
encrypted=encrypt("This is a test 100", toBase64("1A1AA5B64D51677A"),"DES");
Yeah, I was getting that error as well when I tried it too, but I thought it might just be because I wasn't using a correct DES key.
What happens if you generate a key using coldfusion, store the key, encrypt something and then try to use that key in .NET to unencrypt the data?
I gave that a try. It seems that the key generated by CF is not as standard as my .Net libraries are expecting. I'm still digging intothat one.
Thanks again for your help.
It seems as if the DES keys are base64 encoded. not knowing anything about DES, I don't know if this is standard or not. You should be able to convert back to binary using a combination of the toBinary() and toString() CF functions. I think the following will convert base64 back into normal text:
the results might be a little weird, though.