Forums » API Tips and Tricks »
Flex and AESEncryption.
Added by Nepherkaan almost 6 years ago
There's a php function (function_aes.php) provided with Ryzom API to create secure key, and to encrypt and decrypt all kind of content.
If like me you wish to use this function from Flex, it's a little bit hard, as the encryption toolkits for Flex are not compatible with the php one.
Here's a workaround :
- First Make a backup of your index.template.html.
- Get the attached file and paste it in your folder. It only adds a javascript function from the same author as function_aes.php at the bottom of the file. You might loose personnal modifications.
- Edit and add the jscript manually to your index.template.html before the </body>
Now inside your .AS file you can call these Javascript functions like:
var EncodedString:String = ExternalInterface.call("AESEncryptCtr", "My text to encode", "My secretpassword, 128);
var DecodedString:String = ExternalInterface.call("AESDecryptCtr", EncodedContentFromThePhpFunc, "My secretpassword, 128);
And the function_aes.php script will be able to decrypt without any problem the encodedString and vice-versa.
Link to the google-project : http://code.google.com/p/as3-to-php-aes-dataservice/downloads/list
index.template.html - file with Javascript Function. (22.7 kB)