i just wanna ask how to encrypt database using adobe air 2.0. I found some codes using Adobe air 1.5. here the codes:
// Include AIRAliases.js to use air.* shortcuts
var conn = new air.SQLConnection();
conn.addEventListener(air.SQLEvent.OPEN, openHandler);
conn.addEventListener(air.SQLErrorEvent.ERROR, errorHandler);
var dbFile = air.File.applicationStorageDirectory.resolvePath("DBSample.sqlite");
var 开发者_StackOverflowencryptionKey = new air.ByteArray();
encryptionKey.writeUTFBytes("Some16ByteString"); // This technique is not secure!
conn.openAsync(dbFile, air.SQLMode.CREATE, null, false, 1024, encryptionKey);
function openHandler(event)
{
air.trace("the database opened successfully");
}
function errorHandler(event)
{
if (event.error.errorID == 3138)
{
air.trace("Incorrect encryption key");
}
else
{
air.trace("Error message:", event.error.message);
air.trace("Details:", event.error.details);
}
}
it doesn't work. it just shows error : air.SQLMode is not an object
anybody can fix it? Thanks
The reason you're seeing the air.* aliases is because the example is intended to be used in JavaScript. If you're using ActionScript you'll need to remove the air.* aliases and just import the classes instead.
For JavaScript, since there is no "import" statement, the AIR team created a file airaliases.js that creates aliases for all the AIR classes, so that you don't have to use the fully-qualified class name every time you want to use the class.
精彩评论