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 />

XML signature validation in AIR<br />

To rely on a certification authority, the signing certificate must be issued by an authority that is trusted on the<br />

computer upon which the signature is validated. Most operating system manufacturers place the root certificates of a<br />

number of certification authorities into the operating system trust store. Users can also add and remove certificates<br />

from the store.<br />

Ev<strong>en</strong> if a certificate is issued by a trusted certification authority, you must still decide whether the certificate belongs<br />

to someone you trust. In many use cases, this decision is passed along to the <strong>en</strong>d-user. For example, wh<strong>en</strong> an AIR<br />

application is installed, the AIR installer displays the id<strong>en</strong>tifying information from the publisher’s certificate wh<strong>en</strong><br />

asking the user to verify whether they want to install the application. In other cases, you might have to compare the<br />

public key or other certificate information to a list of acceptable keys. (This list must be secured, perhaps by its own<br />

signature, or by storing in the AIR <strong>en</strong>crypted local store, so that the list itself cannot be tampered with.)<br />

Note: While you can elect to trust the signing certificate without indep<strong>en</strong>d<strong>en</strong>t verification—such as wh<strong>en</strong> a signature is<br />

“self-signed”—you do not thereby gain much assurance of anything by verifying the signature. Without knowing who<br />

created a signature, the assurance that the signature has not be<strong>en</strong> tampered with, is of little, if any, value. The signature<br />

could be a validly signed forgery.<br />

Certificate expiration and revocation<br />

Adobe AIR 1.5 and later<br />

All certificates expire. Certificates can also be revoked by the issuing certification authority if, for example, the private<br />

key related to the certificate is compromised or stol<strong>en</strong>. If a signature is signed with an expired or revoked certificate,<br />

th<strong>en</strong> the signature will be reported as invalid unless a timestamp has be<strong>en</strong> included as part of the signature. If a<br />

timestamp is pres<strong>en</strong>t, th<strong>en</strong> the XMLSignatureValidator class will validate the signature as long as the certificate was<br />

valid at the time of signing.<br />

A timestamp is a signed digital message from a timestamp service that certifies that the data was signed at a particular<br />

time and date. Timestamps are issued by timestamp authorities and signed by the timestamp authority’s own<br />

certificate. The timestamp authority certificate embedded in the timestamp must be trusted on the curr<strong>en</strong>t machine<br />

for the timestamp to be considered valid. The XMLSignatureValidator does not provide an API for designating a<br />

differ<strong>en</strong>t certificate to use in validating the timestamp.<br />

Implem<strong>en</strong>ting the IURIDerefer<strong>en</strong>cer interface<br />

Adobe AIR 1.5 and later<br />

To validate an XML signature, you must provide an implem<strong>en</strong>tation of the IURIDerefer<strong>en</strong>cer interface. The<br />

implem<strong>en</strong>tation is responsible for resolving the URIs within the Refer<strong>en</strong>ce elem<strong>en</strong>ts of an XML signature docum<strong>en</strong>t<br />

and returning the data so that the digest can be computed. The computed digest is compared with the digest in the<br />

signature to determine if the refer<strong>en</strong>ced data has be<strong>en</strong> altered since the signature was created.<br />

Note: HTML-based AIR applications must import a SWF library containing an ActionScript implem<strong>en</strong>tation in order to<br />

validate XML signatures. The IURIDerefer<strong>en</strong>cer interface cannot be implem<strong>en</strong>ted in JavaScript.<br />

The IURIDeref<strong>en</strong>cer interface has a single method, derefer<strong>en</strong>ce(uri:String), that must be implem<strong>en</strong>ted. The<br />

XMLSignatureValidator object calls this method for each refer<strong>en</strong>ce in the signature. The method must return the data<br />

in a ByteArray object.<br />

Last updated 6/6/2012<br />

862

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

Saved successfully!

Ooh no, something went wrong!