Array

Using Encrypted Local Storage

Must Read

Admin
Admin
Just post!

AIR has an encryption functionality which you can use to store sensitive data. The data is encrypted using AES-CBC 128-bit. Although this capability is not available for Android at the time of this writing, it is worth discussing in case it is added in the future.

The EncryptedLocalStorage static class belongs to the flash.data package and inherits from Object. The data is application-specific and can only be retrieved from within its security sandbox. It is saved as a ByteArray and requires a key.

To encrypt the data, use:

encrypt the data, use:
import flash.utils.ByteArray;
import flash.data.EncryptedLocalStore;
function write():void {
var myData:ByteArray = new ByteArray();
myData.writeUTFBytes(“my very sensitive data”);
EncryptedLocalStore.setItem(“myKey”, myData);
}
To decrypt the data, use:
function read():void {
var myData:ByteArray = EncryptedLocalStore.getItem(“myKey”);
if (myData != null) {
trace(myData.readUTFBytes(myData.bytesAvailable);
}
}
To remove the data, use:
function delete():void {
EncryptedLocalStore.removeItem(“myKey”);
}

 

- Advertisement -

Latest News

Yadea Becomes Official Supplier for Hangzhou Asian Games

Yadea Named Official Supplier for Hangzhou 2023 Asian Games, Hosts Fun Run Events in Sri Lanka, Laos, and Vietnam Yadea,...
- Advertisement -

More Articles Like This

- Advertisement -