By Crypto I meant the AS3 library you link to, which is named "As3
Crypto". I'm pulled up my code.
You should be able to use the CryptoDemo to create a Key in Hex. Once
you have the key, you should be able to do something like this in CF:
<cfset HexKey = "8738fed68e7677d374e0946c8f7bd3bb">
<cfset myKey = ToBase64(BinaryDecode(HexKey, "Hex"))>
<cfset PlainText = "This is a Test">
<Cfset Encrypted = Encrypt(PlainText, MyKey, 'AES','Hex')>
<Cfset Decrypted = Decrypt( Encrypted, MyKey, 'AES','Hex')>
<cfoutput>
Hex Key: #HexKey#<br />
Key as string: #hexToString(HexKey)#<Br>
Key: #MyKey#<Br>
Plain Text: #PlainText#<br>
Encrypted: #Encrypted#<Br>
Decrypted: #Decrypted#<br>
</cfoutput>
You'll probably want something a bit more 'dynamic' but hopefully this
will get you going. I haven't looked at it in months, so the code is
not fresh in my mind...
ivansebastiansurya wrote:
>
>
> Crypto? You mean ColdFusion?
> Seems like I can't decode the encoded string.
> Thanks.
>
> I use the library at http://crypto.hurlant.com/ <http://crypto.hurlant.com/>
> Thanks,
>
> Ivan.
>
> --- In [email protected] <mailto:flexcoders%40yahoogroups.com>,
> Jeffry Houser <[EMAIL PROTECTED]> wrote:
> >
> >
> > Which library?
> >
> > I've been able to successfully pass data back and forth between
> Flex
> > and Crypto using AES.
> >
> > There are settings you need to specify (128 bit something?), but
> w/o
> > pulling the code, I don't remember them.
> >
> > ivansebastiansurya wrote:
> > >
> > >
> > > Hi there,
> > >
> > > Has anyone attempted to encode some string in Flex and decode it
> in
> > > COldFusion?
> > > I've attempted to encode the string using the library in
> > > http://crypto.hurlant.com/ <http://crypto.hurlant.com/>
> <http://crypto.hurlant.com/ <http://crypto.hurlant.com/>>
> > > as follows:
> > > var key:ByteArray = Hex.toArray(model.hashKey); // some key
> > > var cipher:ICipher = Crypto.getCipher("aes", key);
> > > var rawData:ByteArray = Hex.toArray(dataToEncrypt);
> > > I then send the encrypted data as a string (Hex.fromArray
> > > (encryptedByteArray).
> > >
> > > I then try to decrypt it in ColdFusion, using:
> > > decrypted=decrypt(arguments.xmlString,
> > > application.hashkey, "AES", "Hex");
> > >
> > > , but it doesn't seem to work.
> > >
> > > If anyone can help me out, that would be greatly appreciated.
> > > Thanks,
> > >
> > > Ivan.
> > >
> > >
> >
> > --
> > Jeffry Houser, Technical Entrepreneur, Software Developer, Author,
> > Recording Engineer
> > AIM: Reboog711 | Phone: 1-203-379-0773
> > --
> > My Company: <http://www.dot-com-it.com <http://www.dot-com-it.com>>
> > My Podcast: <http://www.theflexshow.com <http://www.theflexshow.com>>
> > My Blog: <http://www.jeffryhouser.com <http://www.jeffryhouser.com>>
> >
>
>
--
Jeffry Houser, Technical Entrepreneur, Software Developer, Author,
Recording Engineer
AIM: Reboog711 | Phone: 1-203-379-0773
--
My Company: <http://www.dot-com-it.com>
My Podcast: <http://www.theflexshow.com>
My Blog: <http://www.jeffryhouser.com>