troubleshooting Question

Decrypting A String of Numbers Using ColdFusion decrypt tag

Avatar of billg7
billg7Flag for United States of America asked on
Web ServersColdFusion Language
5 Comments1 Solution760 ViewsLast Modified:
Hi Experts,

I'm trying to write a script that will take a 20 digit string of base10 numbers (e.g., 1234-5678-9012-3456-7890) that is encrypted from an 18 digit base10 number (e.g., 123456789012345678) and decrypt back to the original 18 digit number. The 18digit number was encoded with 3DES (DESEDE). The three keys are in hex (e.g., key1=4e4e4e4e4e4e4e4e, key2=4e4e4e4e4e4e4e4e, key3=4e4e4e4e4e4e4e4e - yes I'm aware; this set of keys makes it very insecure and equivalent to single DES, it's just for example). My thinking was that the following code would work, but I was wrong. I'm guessing I have a simple syntax problem or it's passing a bad format and the hex number is not being recognized as an actual hex number, so it may be just setting the variable correctly as a hex that will fixit... Please help and thank you in advance!!


<cfset MyString="12345678901234567890"> *Note: the 20 dig encrypted base 10 number
<cfset MyKey="4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e4e">
<cfset decrypted_text= decrypt(MyString, MyKey, "DESEDE","HEX")>
 
<CFOUTPUT>#decrypted_text#
ASKER CERTIFIED SOLUTION
gdemaria

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros