Thanks JJ,

You were actualy pretty much spot on, I wasnt thinking straight and was
trying to decrypt the version of my string that wasnt encrypted.

Also, I need to add the last parameter into the en/decrypt which was 'HEX'
it all works an absolute charm now.

Thanks bud,

Rob

> It looks like you are not "decrypting" an encrypted string...
>
>
> <cfset decrypted = Decrypt(myString, myKey, "AES") />
>
> would need to be
>
> <cfset decrypted = Decrypt(encrypted, myKey, "AES") />
>
>
> or I may just be missing something else at first glance also.
>
>
> J.J.
>
>
>
> On 6/3/07, Robert Rawlins - Think Blue
> <[EMAIL PROTECTED]>
> wrote:
>>
>> Hello Guys,
>>
>>
>>
>> I'm having trouble working with encrypt() and decrypt(). I've generated
>> my
>> own key and I'm trying to use AES encryption on a simple 'hello world'
>> string, see my code below.
>>
>>
>>
>> <cfset myKey = ToBase64(BinaryDecode("12345678901234567890123456789012",
>> "Hex")) />
>>
>>
>>
>> <cfset myString = "Hello World" />
>>
>>
>>
>> <cfset encrypted = Encrypt(myString, myKey, "AES") />
>>
>>
>>
>> <cfset decrypted = Decrypt(myString, myKey, "AES") />
>>
>>
>>
>> <cfoutput>
>>
>> string: #myString#<br/>
>>
>> key: #myKey#<br />
>>
>> Encrypted: #encrypted#<br />
>>
>> Decrypted: #decrypted#<br />
>>
>> </cfoutput>
>>
>>
>>
>> However, this won't run and throws the following error at me 'The input
>> and
>> output encodings are not same.' Does anyone know what might be causing
>> this
>> issue? I've tried taking some other pieces of code from the Adobe
>> Technotes
>> on this encryption stuff, found here
>> <http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=e546373d#block>
>> http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=e546373d#block
>> for
>> generating my own key, but that code didn't work, syntax errors and it
>> produces a key of the wrong length J
>>
>>
>>
>> Thanks for any input guys,
>>
>>
>>
>> Rob
>>
>>
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279952
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to