Datasheet
Luchner c01.tex V3 - 03/20/2008 2:29pm Page 12
Chapter 1: The Development Environment
Now all that is left is packaging the application into an AIR file for installation using the AIR Developer
Tool (ADT). The ADT batch file can be found in the
/bin
folder or the AIR installation directory, and has
commands to create and sign certificates and create AIR application installer files.
Preparing an AIR installer file is a multi-step process, as each application must be signed using a digital
certificate. As mentioned earlier, you can sign your AIR application by linking a certificate from a cer-
tificate authority, such as VeriSign or Thawte, or you can use the ADT to create a self-signed certificate.
Using a certificate from a recognized provider assures users that they are not installing a fraudulent copy
of your AIR application. Using a self-signed certificate does not provide information verifying the iden-
tity of the signer, but for the purposes of the examples used throughout this book, the applications you
build will use a self-signed certificate.
To create a certificate to be signed when packaging your application into an AIR installer file, open a
command prompt and change the directory to that of the development folder for the Hello World project.
Enter the following command and press Enter:
>adt -certificate -cn HelloWorld 1024-RSA certificate.pfx password
Included in this command to generate a certificate and associated private key is the common name, the
key type to use for the certificate (either 1024-RSA or 2048-RSA), the path of the generated certificate
file (using either the .
pfx
or .
p12
extension) and the password used when signing the AIR file. To learn
about additional operational parameters you can add when using the ADT
-certificate
command
(such as your organization name), refer to the AIR documentation or enter > adt -help at the command
prompt.
The certificate and private key are stored in a PKCS12-type keystore file, which is used to sign and pack-
age an AIR file using the
-package
command of the ADT tool.
With a command prompt open and pointing to the HelloWorld project development folder, enter the
following command and press Enter:
> adt -package -storetype pkcs12 -keystore certificate.pfx HelloWorld.air
HelloWorld-app.xml HelloWorld.swf
The
-storetype
parameter value is the version of the PKCS (Public Key Cryptography Standards)
standard for storing private keys and certificates. The container, or keystore — created in the previ-
ous
-certificate
command and provided here as
certificate.pfx
for the
-keystore
parameter — is
encrypted with a password. When you run the
-package
command, you will be prompted to enter the
password you supplied when creating the certificate.
Following the signing options of the
-package
command is the name of the generated AIR file, the appli-
cation descriptor file, and the application SWF file. Along with the application SWF file, you can specify
additional space-delimited files and directories to be added to your build. Additional values (delim-
ited by spaces) could include any icon files or embedded media you may need packaged with your
application. The files and directories, however, need to reside in the current directory or any subdirec-
tories in which the ADT is run. As such, you can use the
-C
option to change the directory for included
files.
For example, you may have the following folder structure within the HelloWorld project:
12