如何使用Adobe AIR 2.0加密数据库SQLite的 [英] How to encrypt database SQLite using Adobe AIR 2.0
问题描述
我只想问如何使用Adobe AIR 2.0加密数据库。我发现C $ CS约$使用Adobe AIR 1.5。这里的C $ CS $:
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 encryptionKey = 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);
}
}
这是行不通的。它只是显示错误: air.SQLMode不是一个对象
任何人都可以修复它?谢谢
anybody can fix it? Thanks
推荐答案
你看到空气中的原因。*别名,是因为这个例子的目的是在JavaScript中使用。如果你使用ActionScript,你将需要删除的空气。*别名,只导入类来代替。
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.
有关JavaScript的,因为没有进口的说法,AIR团队创建的所有AIR类创建别名文件的AIRAliases.js,这样就不必每次都使用完全限定类名要使用的类。
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.
这篇关于如何使用Adobe AIR 2.0加密数据库SQLite的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!