Tuesday, October 27, 2009

Why Rijndael Key return a hidden code?

Today I check on my script, why the Rijndael key return a hidden code in my flex. My script is decode the string in from the base64() , then using the Rijndael to split out the key, but the return result is there have a hidden block behind the return code.

So , I replaced the block with this method.


My Solution :

var decrypted:String;
var baseResult:String;
var rijndael:Rijndael=new Rijndael();
var base64:Base64=new Base64();
var replacePattern:RegExp = /\x00/g;


baseResult=base64.decode(encryptedText);
decrypted=rijndael.decrypt(baseResult, ENCRYPTIONKEY, "ECB");
decrypted = decrypted.replace(replacePattern, "");


return decrypted;

No comments:

Post a Comment

Your comments is appreciate.