13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Working with local SQL databases in AIR<br />

Using <strong>en</strong>cryption with SQL databases<br />

Adobe AIR 1.5 and later<br />

All Adobe AIR applications share the same local database <strong>en</strong>gine. Consequ<strong>en</strong>tly, any AIR application can connect to,<br />

read from, and write to an un<strong>en</strong>crypted database file. Starting with Adobe AIR 1.5, AIR includes the capability of<br />

creating and connecting to <strong>en</strong>crypted database files. Wh<strong>en</strong> you use an <strong>en</strong>crypted database, in order to connect to the<br />

database an application must provide the correct <strong>en</strong>cryption key. If the incorrect <strong>en</strong>cryption key (or no key) is<br />

provided, the application is not able to connect to the database. Consequ<strong>en</strong>tly, the application can’t read data from the<br />

database or write to or change data in the database.<br />

To use an <strong>en</strong>crypted database, you must create the database as an <strong>en</strong>crypted database. With an existing <strong>en</strong>crypted<br />

database, you can op<strong>en</strong> a connection to the database. You can also change the <strong>en</strong>cryption key of an <strong>en</strong>crypted database.<br />

Other than creating and connecting to <strong>en</strong>crypted databases, the techniques for working with an <strong>en</strong>crypted database<br />

are the same as for working with an un<strong>en</strong>crypted one. In particular, executing SQL statem<strong>en</strong>ts is the same regardless<br />

of whether a database is <strong>en</strong>crypted or not.<br />

Uses for an <strong>en</strong>crypted database<br />

Adobe AIR 1.5 and later<br />

Encryption is useful any time you want to restrict access to the information stored in a database. The database<br />

<strong>en</strong>cryption functionality of Adobe AIR can be used for several purposes. The following are some examples of cases<br />

where you would want to use an <strong>en</strong>crypted database:<br />

A read-only cache of private application data downloaded from a server<br />

A local application store for private data that is synchronized with a server (data is s<strong>en</strong>t to and loaded from the<br />

server)<br />

Encrypted files used as the file format for docum<strong>en</strong>ts created and edited by the application. The files could be<br />

private to one user, or could be designed to be shared among all users of the application.<br />

Any other use of a local data store, such as the ones described in “Uses for local SQL databases” on page 713, where<br />

the data must be kept private from people who have access to the machine or the database files.<br />

Understanding the reason why you want to use an <strong>en</strong>crypted database helps you decide how to architect your<br />

application. In particular, it can affect how your application creates, obtains, and stores the <strong>en</strong>cryption key for the<br />

database. For more information about these considerations, see “Considerations for using <strong>en</strong>cryption with a database”<br />

on page 761.<br />

Other than an <strong>en</strong>crypted database, an alternative mechanism for keeping s<strong>en</strong>sitive data private is the <strong>en</strong>crypted local<br />

store. With the <strong>en</strong>crypted local store, you store a single ByteArray value using a String key. Only the AIR application<br />

that stores the value can access it, and only on the computer on which it is stored. With the <strong>en</strong>crypted local store, it<br />

isn’t necessary to create your own <strong>en</strong>cryption key. For these reasons, the <strong>en</strong>crypted local store is most suitable for easily<br />

storing a single value or set of values that can easily be <strong>en</strong>coded in a ByteArray. An <strong>en</strong>crypted database is most suitable<br />

for larger data sets where structured data storage and querying are desirable. For more information about using the<br />

<strong>en</strong>crypted local store, see “Encrypted local storage” on page 709.<br />

Last updated 6/6/2012<br />

757

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!