I see what you mean... have you tried using javacast? Cast each item as a string inside a variable, then manipulate them with formatBaseN( ) and then concatenate (or whatever the order is). Make sure your are concat'ing variables not constancts
Note... <Cfset x = var1 & var2 & var3/> But... <cfset x = var1 & '00000' & '10'/> I'm not sure this will work, but the trick is to make sure that the "under the hood" java believes the vars are strings. -Mark -----Original Message----- From: megan cytron [mailto:[email protected]] Sent: Monday, March 15, 2010 7:30 PM To: cf-talk Subject: Re: aes--any way to encrypt a hex encoded string in CF? Hey Mark-- Thanks for the response. My understanding is that they are converting "1234567891234567" as a string, not as a number, so that when they encode the card number they get: 1234567891234567 --> hex: 31323334353637383931323334353637 When I encrypt "1234567891234567" using cfencrypt and hex encoding, I get the first half of their result--so the card number string doesn't seem to be the problem: My encryption result: 1DF20DDA4A5C45DCD2BCDB191D08559C Their result: 1DF20DDA4A5C45DCD2BCDB191D08559CC3BF026C725CBB1C366ADEC4867917AA It's their padding that is the issue--the last byte of which IS a hex number representing how many total characters of padding were added: 00000000000000000000000000000010 (10hex=16 characters of padding) I can't figure out how to get this additional padding into the CF encrypt tag, so that I can get the same results, because I'm passing a regular string in... theirs appears to be a hex-encoded string for the card number + padding zeroes + a hex number representing the total number of characters of padding. This is the code I'm using: <cfset encoding = "hex"> <cfset iv=BinaryDecode("00000000000000000000000000000000", "Hex")> <cfset key = ToBase64(BinaryDecode("SECRETKEYHERE", "Hex"))> <cfset algorithm = "AES/CBC/NoPadding"> <cfset str =1234567891234567> <cfset enc = Encrypt(str, key, algorithm, encoding,iv)> My result--> 1DF20DDA4A5C45DCD2BCDB191D08559C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331778 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

