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:331776
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to