Adobe® AIR® API Reference for HTML Developers
Home  |  Show Classes List |  Index  |  Appendixes

Language Reference only       
EncryptedLocalStore 
3D:
Context3D
Context3DBlendFactor
Context3DClearMask
Context3DCompareMode
Context3DProgramType
Context3DRenderMode
Context3DStencilAction
Context3DTextureFormat
Context3DTriangleFace
Context3DVertexBufferFormat
CubeTexture
IndexBuffer3D
Program3D
Stage3D
Texture
VertexBuffer3D
Air.net:
ServiceMonitor
SocketMonitor
URLMonitor
Air.update:
ApplicationUpdater
ApplicationUpdaterUI
DownloadErrorEvent
StatusFileUpdateErrorEvent
StatusFileUpdateEvent
StatusUpdateErrorEvent
StatusUpdateEvent
UpdateEvent
Data:
EncryptedLocalStore
SQLCollationType
SQLColumnNameStyle
SQLColumnSchema
SQLConnection
SQLError
SQLErrorEvent
SQLErrorOperation
SQLEvent
SQLIndexSchema
SQLMode
SQLResult
SQLSchema
SQLSchemaResult
SQLStatement
SQLTableSchema
SQLTransactionLockType
SQLTriggerSchema
SQLUpdateEvent
SQLViewSchema
Desktop:
Clipboard
ClipboardFormats
ClipboardTransferMode
DockIcon
Icon
InteractiveIcon
NativeApplication
NativeProcess
NativeProcessStartupInfo
NotificationType
SystemTrayIcon
Display:
BitmapData
NativeMenu
NativeMenuItem
Screen
Stage
StageDisplayState
StageQuality
Events:
ActivityEvent
AsyncErrorEvent
BrowserInvokeEvent
DataEvent
DatagramSocketDataEvent
DNSResolverEvent
DRMAuthenticateEvent
DRMStatusEvent
ErrorEvent
Event
EventDispatcher
FileListEvent
HTTPStatusEvent
InvokeEvent
InvokeEventReason
IOErrorEvent
LocationChangeEvent
MouseEvent
NativeProcessExitEvent
NetDataEvent
NetMonitorEvent
NetStatusEvent
OutputProgressEvent
ProgressEvent
SampleDataEvent
SecurityErrorEvent
ServerSocketConnectEvent
StatusEvent
StorageVolumeChangeEvent
TimerEvent
UncaughtErrorEvent
UncaughtErrorEvents
File:
File
FileMode
FileStream
StorageVolume
StorageVolumeInfo
Functions:
trace()
generateRandomBytes()
navigateToURL()
sendToURL()
Geom:
Matrix
Point
Rectangle
Media:
AudioDecoder
AudioPlaybackMode
H264Level
H264Profile
H264VideoStreamSettings
ID3Info
InputMediaStream
Microphone
MicrophoneEnhancedMode
MicrophoneEnhancedOptions
Sound
SoundChannel
SoundCodec
SoundLoaderContext
SoundMixer
SoundTransform
VideoCodec
VideoStatus
VideoStreamSettings
Native window:
NativeWindow
NativeWindowBoundsEvent
NativeWindowDisplayState
NativeWindowDisplayStateEvent
NativeWindowInitOptions
NativeWindowRenderMode
NativeWindowResize
NativeWindowSystemChrome
NativeWindowType
Net:
AAAARecord
ARecord
CertificateStatus
DatagramSocket
DNSResolver
FileFilter
InterfaceAddress
IPVersion
LocalConnection
MXRecord
NetConnection
NetMonitor
NetStreamAppendBytesAction
NetStreamMulticastInfo
NetworkInfo
NetworkInterface
ObjectEncoding
PTRRecord
ResourceRecord
Responder
SecureSocket
ServerSocket
SharedObject
SharedObjectFlushStatus
Socket
SRVRecord
URLLoader
URLLoaderDataFormat
URLRequest
URLRequestDefaults
URLRequestHeader
URLRequestMethod
URLStream
URLVariables
XMLSocket
Security:
ReferencesValidationSetting
RevocationCheckSettings
SignatureStatus
SignerTrustSettings
X500DistinguishedName
X509Certificate
XMLSignatureValidator
System:
Capabilities
Security
System
Updater
Ui:
Keyboard
KeyboardType
KeyLocation
Mouse
MouseCursorData
Utils:
Vector
ByteArray
Collator
CollatorMode
CompressionAlgorithm
CurrencyFormatter
CurrencyParseResult
DateTimeFormatter
DateTimeNameContext
DateTimeNameStyle
DateTimeStyle
Endian
HTMLLoader
HTMLPDFCapability
LastOperationStatus
LocaleID
NationalDigitsType
NumberFormatter
NumberParseResult
StringTools
Timer
window.runtime propertywindow.runtime.flash.data.EncryptedLocalStore
InheritanceEncryptedLocalStore Inheritance Object

Runtime Versions:  1.0

The EncryptedLocalStore class provides a persistent, encrypted data storage mechanism.

AIR provides an encrypted local store (ELS) for each AIR application installed on a user's computer. This lets you save and retrieve data that is stored on the user’s local hard drive in an encrypted format that cannot easily be deciphered by other users. A separate encrypted local store is used for each AIR application, and each AIR application uses a separate encrypted local store for each user account on the computer.

Use the encrypted local store to cache information that must be secured, such as login credentials for web services. The ELS is appropriate for storing information that must be kept private from other users. It does not, however, protect the data from other processes run under the same user account. It is thus not appropriate for protecting secret application data, such as DRM or encryption keys.

AIR uses DPAPI on Windows, KeyChain on Mac OS and iOS, and KeyRing or KWallet on Linux to associate the encrypted local store to each application and user. The encrypted local store uses AES-CBC 128-bit encryption. On Android, a suitable encrypted storage service is not available. Data stored in the encrypted local store is not encrypted on Android; instead, the data is protected by Android's user ID-based filesystem security. This means that on a "rooted" device, other applications running with root privileges can access data stored in the ELS.

Information in the encrypted local store is only available to AIR application content in the application security sandbox.

If you update an AIR application, the updated version retains access to any existing data in the encrypted local store unless:

  • The items were added with the stronglyBound parameter set to true
  • The existing and update versions are both published prior to AIR 1.5.3 and the update is signed with a migration signature

Limitations of the encrypted local store

The data in the encrypted local store is protected by the user’s operating system account credentials. Other entities cannot access the data in the store unless they can login as that user. However, the data is not secure against access by other applications run by an authenticated user. Thus, data that your application may want to keep secret from users, such as keys used for licensing or digital rights management, is not secure. The ELS is not an appropriate location for storing such information. It is only an appropriate place for storing a user’s private data, such as passwords.

Data in the ELS can be lost for a variety of reasons. For example, the user could uninstall the application and delete the encrypted file. Or, the publisher ID could be changed as a result of an update. Thus the ELS should be treated as a private cache, not permanent data storage.

The stronglyBound parameter is deprecated and should not be set to true. Setting the parameter to true does not provide any additional protection for data. At the same time, access to the data is lost whenever the application is updated — even if the publisher ID stays the same. On mobile devices, the stronglyBound parameter is always treated as if set to false.

The encrypted local store may perform more slowly if the stored data exceeds 10MB.

When you uninstall an AIR application, the uninstaller does not delete data stored in the encrypted local store.

The best practices for using the ELS include:

  • Use the ELS to store sensitive user data such as passwords (setting stronglyBound to false)
  • Do not use the ELS to store applications secrets such as DRM keys or licensing tokens
  • Provide a way for your application to recreate the data stored in the ELS if the ELS data is lost. For example, by prompting the user to re-enter their account credentials when necessary.
  • Do not use the stronglyBound parameter.
  • If you do set stronglyBound to true, do not migrate stored items during an update. Recreate the data after the update instead.
  • Only store relatively small amounts of data. For large amounts of data, use an AIR SQL database with encryption.

Items in the encrypted local store are identified with a string. All items are stored as byte array data.

Encrypted local store data is put in a subdirectory of the user's application data directory; the subdirectory path is Adobe/AIR/ELS/ followed by the application ID.

View the examples

See also



Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  isSupported : Boolean
[static] [read-only] The isSupported property is set to true if the EncryptedLocalStore class is supported on the current platform, otherwise it is set to false.
EncryptedLocalStore
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
  
getItem(name:String):ByteArray
[static] The data corresponding to the specified name.
EncryptedLocalStore
 Inherited
hasOwnProperty(name:String):Boolean
Indicates whether an object has a specified property defined.
Object
 Inherited
isPrototypeOf(theClass:Object):Boolean
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is enumerable.
Object
  
removeItem(name:String):void
[static] Removes the item with the given name from the encrypted local store.
EncryptedLocalStore
  
reset():void
[static] Clears the entire encrypted local store, deleting all data.
EncryptedLocalStore
  
setItem(name:String, data:ByteArray, stronglyBound:Boolean = false):void
[static] Stores a ByteArray object under the specified name.
EncryptedLocalStore
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
toLocaleString():String
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
toString():String
Returns the string representation of the specified object.
Object
 Inherited
valueOf():Object
Returns the primitive value of the specified object.
Object
Property Detail

isSupported

property
isSupported:Boolean  [read-only]

Runtime Versions:  2

The isSupported property is set to true if the EncryptedLocalStore class is supported on the current platform, otherwise it is set to false.

Method Detail

getItem

()method
public function getItem(name:String):ByteArray

Runtime Versions:  1.0

The data corresponding to the specified name.

If an item does not exist by the specified name, this method returns null.

Parameters

name:String — The name of the item in the encrypted local store.

Returns
ByteArray — The ByteArray data. If there is no data for the provided name, the method returns null.

Throws
ArgumentError — The name value is null or an empty string.

removeItem

()method 
public function removeItem(name:String):void

Runtime Versions:  1.0

Removes the item with the given name from the encrypted local store.

Parameters

name:String — The name of the item in the encrypted local store.


Throws
ArgumentError — The name value is null or an empty string.

reset

()method 
public function reset():void

Runtime Versions:  1.0

Clears the entire encrypted local store, deleting all data.

setItem

()method 
public function setItem(name:String, data:ByteArray, stronglyBound:Boolean = false):void

Runtime Versions:  1.0

Stores a ByteArray object under the specified name.

Parameters

name:String — The name of the item in the encrypted local store.
 
data:ByteArray — The data.
 
stronglyBound:Boolean (default = false) — (deprecated) The stronglyBound parameter should be set to false (the default value). If set to true, the stored item cannot be retrieved if any application files are altered. For example,if a user installs an update of your application, the updated application cannot read any strongly bound data that was previously written to the encrypted local store. Ignored (treated as false) on mobile devices.


Throws
ArgumentError — The name value is null or an empty string.
 
ArgumentError — The data value is null.
Examples

The following code stores a string in the encrypted local store, retrieves it, and then deletes it:

Note: To test this example:

  • Add the AIRAliases.js file to the project directory.
  • Create an application descriptor file for the project, and test the project using ADL.
<html>
    <head>
      <script src="AIRAliases.js" />
      <script>
        function init() 
        {
            var str = "Bob";
            var bytes = new air.ByteArray();
            bytes.writeUTFBytes(str);
            air.EncryptedLocalStore.setItem("firstName", bytes);
            
            var storedValue = air.EncryptedLocalStore.getItem("firstName");
            air.trace(storedValue.readUTFBytes(storedValue.length)); // "Bob"
            
            air.EncryptedLocalStore.removeItem("firstName");
        }
      </script>
    </head>
    <body onload='init()'>
    </body>
</html>