Packageair.security
Classpublic class Encryption
InheritanceEncryption Inheritance Object

Language version: ActionScript 3.0
Runtime version: AIR 51

The Encryption class is used to encrypt and decrypt ByteArray objects using industry-standard AES-CBC algorithms.



Public Properties
 PropertyDefined by
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined by
  
[static] A utility function for decrypting an arbitrary amount of data.
Encryption
  
[static] A utility function for encrypting an arbitrary amount of data.
Encryption
  
[static] A utility function for generating random data.
Encryption
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Method detail
decrypt()method
public static function decrypt(data:ByteArray, key:ByteArray, iv:ByteArray):ByteArray

Language version: ActionScript 3.0
Runtime version: AIR 51

A utility function for decrypting an arbitrary amount of data.

The decryption uses AES CBC encryption with a key that can be 16, 24 or 32 bytes long (128, 192 or 256 bits). The IV must be 16 bytes long and the data must be a multiple of 16 bytes.

Note that to decrypt properly, the same key and IV should be used as when the data was encrypted.

Parameters
data:ByteArray — A ByteArray object containing the data to decrypt.
 
key:ByteArray — A ByteArray object containing the key that was used in the encryption.
 
iv:ByteArray — A ByteArray object containing the initialization vector to use.

Returns
ByteArray — The decrypted data.

Throws
ArgumentError — If any of the parameters do not meet their required constraints.
encrypt()method 
public static function encrypt(data:ByteArray, key:ByteArray, iv:ByteArray):ByteArray

Language version: ActionScript 3.0
Runtime version: AIR 51

A utility function for encrypting an arbitrary amount of data.

The encryption uses AES CBC encryption with a key that can be 16, 24 or 32 bytes long (128, 192 or 256 bits). The IV must be 16 bytes long and the data must be a multiple of 16 bytes.

Parameters
data:ByteArray — A ByteArray object containing the data to encrypt.
 
key:ByteArray — A ByteArray object containing the key to use in the encryption.
 
iv:ByteArray — A ByteArray object containing the initialization vector to use.

Returns
ByteArray — The encrypted data.

Throws
ArgumentError — If any of the parameters do not meet their required constraints.
getRandomBytes()method 
public static function getRandomBytes(size:uint):ByteArray

Language version: ActionScript 3.0
Runtime version: AIR 51

A utility function for generating random data.

Parameters
size:uint — Number of bytes to generate.

Returns
ByteArray — A ByteArray object containing random data.