我想用 adobe air 加密和解密文件。我成功地用代码加密文件。但我还没有解密加密文件,请帮帮我,我该怎么办?
我正在使用此代码进行加密:
import com.hurlant.crypto.symmetric.AESKey;
import com.hurlant.crypto.symmetric.DESKey;
import com.hurlant.util.Hex;
import flash.filesystem.FileStream;
import flash.filesystem.File;
import flash.utils.ByteArray;
import flash.filesystem.FileMode;
import flash.display.BitmapData;
import flash.display.Bitmap;
import com.hurlant.util.ArrayUtil;
stop();
var stream:FileStream;
var stream2:FileStream;
var file:File;
var fileToEncrypt:ByteArray;
encrypt();
function encrypt():void
{
file = File.applicationDirectory.resolvePath("logo_markatalog.png");
fileToEncrypt = new ByteArray;
stream = new FileStream();
stream.open( file, FileMode.READ );
stream.readBytes(fileToEncrypt);
stream.close();
var appDir:String = File.applicationDirectory.nativePath;
//file = File(appDir+"logo_markatalog_enc.png");
file = new File(appDir+"/logo_markatalog_enc.png");
var key:ByteArray = Hex.toArray("635232557");
var aes:AESKey = new AESKey(key);
aes.encrypt(fileToEncrypt);
stream2 = new FileStream();
stream2.open( file, FileMode.WRITE );
stream2.writeBytes(fileToEncrypt);
stream2.close();
}