Using Encrypted Local Storage


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 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;
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) {
To remove the data, use:
function delete():void {