xz876513579 / as3crypto

Automatically exported from code.google.com/p/as3crypto
0 stars 0 forks source link

Encryption error #40

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
using this code:
import com.hurlant.crypto.Crypto;
import com.hurlant.crypto.symmetric.ICipher;
import com.hurlant.util.Hex;
import flash.events.MouseEvent;

var key:ByteArray = Hex.toArray("1234567890abcdef");
var cip:ICipher = Crypto.getCipher("simple-aes-cbc", key);
var dat1:ByteArray = Hex.toArray(Hex.toString("flashguru"));
var dat2:ByteArray = Hex.toArray(Hex.fromString("flashguru"));   

trace("Key "+String(key) ); //Key 4Vx«Íï
trace("Data "+String(dat1) ) //Data 
trace("Data "+String(dat2) ) //Data flashguru
trace("ENcry1 "+cip.encrypt(dat1)); //ENcry1 undefined
trace("DEcry1 "+cip.decrypt(dat1)); //DEcry1 undefined

trace("ENcry2 "+cip.encrypt(dat2)); //ENcry2 undefined
trace("DEcry2 "+cip.decrypt(dat2)); //DEcry2 undefined

You can see it returns undefined. Ive tried so many variants as well ripping 
off code and modifying from examples, but still, i get undefined.
Weird thing is that when ripping from demo source, i get undefined but in the 
demo all works.
What am i missing ? And no, as3 is the exakt same as in demo files, should it 
not be returning encrypted data anyway or is this just not working in Flash IDE 
?

All these tests ive made, it seems there is something bugging with 
Hex.toArray() but it could be me who missing some  important part...

Original issue reported on code.google.com by protot...@gmail.com on 19 Jun 2010 at 12:52