Establishing Trust for MIDlet Suites by Using X.509
PKI
The mechanisms for signing and authenticating MIDlet suites are
based on Internet standards for public key cryptography RFC 2437 [reference 6],
RFC 2459 [reference 7], RFC 2560 [reference 8],
and WAPCERT [reference 15].
A developer can put a digital
signature of the MIDlet suite's JAR and a certificate in the MIDlet suite's application
descriptor. A digital signature is a piece of data, created with the private key
of a private-public key pair, that ensures the JAR has not been tampered
with.
A certificate contains the corresponding public key that can be
used to check the digital signature in the JAR and the signature of an entity
that vouches that the public key in the certificate is genuine. The application
descriptor can also have another certificate that contains the public key of the
vouching entity and the signature of the entity that vouches for it. This can
continue until there is a certificate for a well-known and trusted entity that
does not need another entity to vouch for it; it vouches for itself. Such an
entity is called a certificate authority (CA),
and the certificate is said to be self-signed.
Self-signed certificates are also called root
certificates. Root certificates reside on the device, not in the
application descriptor. A series of certificates that begins with the JAR signer
and ends with a CA is called a certificate
chain.
Normally the development environment for MIDP applications will
include tools to handle signing of a MIDlet suite and putting the appropriate
certificates into the suite's application descriptor, so application developers
should not have to understand these details. However, developers may still need
to be aware of the protection domains on their target devices so that they can
obtain the appropriate certificates.
When a user tries to install a signed MIDlet suite, the device
authenticates the suite by verifying the signer certificates and JAR signature.
Authentication enables the device to assign the MIDlet suite to a protection
domain and appropriately authorize the MIDlets. Devices associate protection
domains with CAs. For example, the device might assign the MIDlet suites that
use the device manufacturer for their root certificate to one domain and the
MIDlet suites that use the MIDP implementor for their root certificate to
another. The root certificate associated with a protection domain is called the
protection domain root certificate.
In the case where there is a trusted relationship (possibly
bound by legal agreements), the owner of a protection domain root certificate
may delegate signing MIDlet suites to a third party and, in some circumstances,
the author of the MIDlet.
18.5.1 Signing a MIDlet
Suite
The signer of a MIDlet suite might be the developer or an
entity responsible for distributing, supporting, and perhaps billing for the use
of the MIDlet suite. The signer is responsible for ensuring that the MIDlet
suite's applications are not malicious and will not harm assets or capabilities.
The signer must exercise due-diligence in checking the MIDlet suite before
signing it.
The signer must have a private and public key pair. The signer
uses the private key to sign the MIDlet suite, and provides the public key in an
RSA X.509 certificate for the MIDlet suite's application descriptor. That
certificate might be validated by another certificate, and so on, except for the
final certificate in the application descriptor. The final certificate in the
application descriptor is validated by a protection domain root certificate on
the device.
The signature of a MIDlet suite protects only the JAR
containing the manifest, the MIDlets' classes, and any additional resources. The
signature does not protect the application descriptor; it is not secured.
Attributes defined within the manifest are protected by the signature, but
attributes in the application descriptor are not.
 |
Because attributes defined in the application descriptor are
not secured, when an attribute appears in the manifest, it must not be
overridden by a different value from the application descriptor. For trusted
MIDlet suites, the value in the application descriptor must be equal to the
value of the corresponding attribute in the manifest. If not, the MIDlet suite
must not be installed. The MIDlet.getAppProperty method returns the
attribute value from the manifest if one is defined. If not defined, the value
from the application descriptor, if any, is
returned. |
Note that the requirement for attribute values to be equal
differs from MIDP 1.0 and must be used for applications that are signed and
verified by these procedures. For untrusted MIDlet suites, the MIDP 1.0 rule
gives priority to application descriptor attributes instead of manifest
attributes.
Examples of MIDlet Suite Signing
There are many ways to structure protection domain root
certificates and their associated signing policies. These examples show two
possibilities.
Example 1 – Developer Owns Signing Certificate
This example covers the case where the developer owns the signing certificate and uses it to sign the
application. In this case, the origin of the MIDlet suite is encoded into the
application descriptor; it is the identity of the signer.
-
Developer creates a MIDlet.
-
Developer encodes permission requests into the JAR's manifest
and creates a final MIDlet suite JAR.
-
Developer generates a private-public key pair with a signing
certificate and has the certificate signed by one or more protection domain root
certificates.
-
Developer's certificate is used to sign the MIDlet's JAR and
create the associated entries in the application descriptor.
-
MIDlet suite can be distributed with a suitably populated
application descriptor and run on a MIDP 2.0-compliant device that has an
appropriate protection domain root certificate, as long as the certificate is
valid.
Example 2 – Protection-Domain Stakeholder Owns
Signing Certificate
This example covers the case where the signer's identity (not
the MIDlet suite developer) is encoded into the application descriptor.
-
Developer creates a MIDlet.
-
Developer encodes permissions into the JAR's manifest and
creates a final MIDlet JAR.
-
The protection domain stakeholder's signing certificate (not
necessarily the root certificate) is used to sign the MIDlet JAR and create the
associated entries in the application descriptor.
-
The MIDlet suite can be distributed with a suitably populated
application descriptor and run on a MIDP 2.0-compliant device that has an
appropriate protection domain root certificate, as long as the certificate is
valid.
Creating the Signing Certificate
The signer will need to be aware of the authorization policy
for the target device and identify which protection domain the MIDlet suite
should operate in. The domain's protection domain root certificate must be the
root of the certificate chain. The signer will need to contact the appropriate
certificate authority. At the time of this writing, the best place to begin to
determine the correct domain and certificate authority is to contact the
developer program of the network operator or the device manufacturer. The signer
might need to send its distinguished name (DN) and public key (normally,
packaged in a certificate request) to the certificate authority who would create
a RSA X.509 (version 3) certificate and return it to the signer.
If the MIDlet suite will need to run on devices with different
protection domains or protection domain root certificates, then the signer would
need to use the same public key for verification but get a different signing
certificate from each certificate authority. All of the signer certificates in
the MIDlet suite's application descriptor must contain the same public key.
The signer should also remain aware of the certificate's
status. If the certificate expires, new installs will not succeed. If the
certificate is disabled or revoked, every user on every device that supports
revocation will have their execution permissions revoked.
Inserting Certificates into the Application
Descriptor
The certificate chain, except the root certificate, must be
included in the application descriptor. The root certificate will be found on
the device. Each certificate in the path is encoded (using base64 but without
line breaks) and inserted into the application descriptor as: MIDlet-Certificate-n-m: base64-encoding-of-certificate
The certificates are numbered to define the sequence in which
they are examined. The number n is one
(1) for the first certificate chain in the descriptor. The number n should increment by one for each subsequent
certification chain. The order defines the sequence in which the certificate
chains are tested to see if the corresponding root certificate exists on the
device. The number m is one (1)
for the signer's certificate in a certification chain and increments by one for
each subsequent intermediate certificate (if any).
Creating the RSA SHA-1 Signature of the JAR
The signature of the MIDlet suite JAR is created with the
signer's private key according to the EMSA-PKCS1-v1_5 encoding method of PKCS #1
version 2.0 standard [reference 6]. The signature
is base64 encoded, formatted as a single MIDlet-Jar-RSA-SHA1 attribute
without line breaks and inserted in the application descriptor. MIDlet-Jar-RSA-SHA1: base64-encoding-of-Jar-signature
18.5.2 Authenticating a MIDlet Suite
When a MIDlet suite is downloaded, a device that recognizes
MIDlet suites signed using PKI as trusted must check whether authentication is
required. If the attribute MIDlet-Jar-RSA-SHA1 is present in the
application descriptor, then the JAR must be authenticated by verifying the
signer certificates and JAR signature. Application descriptors without the
MIDlet-Jar-RSA-SHA1 attribute are not authenticated but are installed
and invoked as untrusted MIDlet suites.
Verifying the Signer's Certificate
When a device verifies the signer certificate, it tries to find
a certificate chain that ends with a root certificate on the device. (Root
certificates may also be present in removable media such as a SIM(WIM) card or a
USIM module. The device implicitly trusts these roots to verify the integrity
and authentication of MIDlet suites.)
To verify a signature, the device extracts a certificate chain
from the application descriptor. It first gets attributes
MIDlet-Certificate-1-m, where
m starts at one and increments by one
until there is no attribute with the given name. The value of each attribute is
a base64-encoded certificate that it must decode and parse. The device validates
the certificate chain using the basic path validation processes described in RFC
2459 [reference
7] with the protection domains as the authoritative source of protection
domain root certificates. The MIDlet suite is bound to the protection domain
that contains the protection domain root certificates that validates the first
chain from signer to root and proceed with installation.
If no protection domain root certificate validates the first
chain, the device checks for other certificate chains. If there are multiple
chains present, the device should check the chain with the attributes
MIDlet-Certificate-2-m, and so
on, until a chain can be validated or there are no more chains to check. Table 18.4 indicates how the results of
certificate verification are acted upon.
Table 18.4. Actions upon completion of signer
certificate verification
|
Attempted to validate n
paths, but no public keys of the issuer of the certificate can be found or none
of the certification paths can be validated. |
Authentication fails; the MIDlet suite will not be
installed. |
|
More than one full certificate path established and
validated. |
Installation proceeds using the first successfully verified
certificate path; next step is verification of the JAR signature. |
|
Only one full certificate path established and
validated. |
Implementation proceeds; next step is verification of the JAR
signature. |
Verifying the MIDlet Suite JAR
The MIDlet suite JAR is verified to insure the integrity of the
application. The MIDlet-Jar-RSA-SHA1 attribute is retrieved from the
application descriptor and decoded from base64 yielding a PKCS #1 signature. The
signer's public key from the signer certificate is used to verify the signature.
If the signature verification fails, the MIDlet suite is rejected.
The SHA-1 hash of the MIDlet suite JAR must match the message
digest in the signature. If it does not match, the device must not install the
JAR or allow MIDlets from the MIDlet suite to be invoked.
Once the steps of verifying the certificate, verifying the
signature, and verifying the JAR all succeed, the MIDlet suite contents are
known to be intact and the identity of the signer is known.
Results of MIDlet Suite Source Verification
It is essential that the steps performed to verify the digital
signature as previously described lead to proof of the identity of the MIDlet
suite signer. The results of the verification have a direct impact on
authorization. Table 18.5 summarizes
the state in which the device found the MIDlet suite and where the signature
verification led.
Table 18.5. Summary of MIDlet suite source
verification
|
JAD not present.
JAR was downloaded. |
Authentication cannot be performed. |
Installation permitted; MIDlet suite is treated as
untrusted. |
|
JAD present.
JAR is unsigned. |
Authentication cannot be performed. |
Installation permitted MIDlet suite is treated as
untrusted. |
|
JAR signed.
No root certificate on the device to validate the certificate
chain. |
Authentication cannot be performed. |
Installation not permitted. |
|
JAR signed.
A certificate on the path is expired. |
Authentication cannot be completed. |
Installation not permitted. |
|
JAR signed.
A certificate rejected for reasons other than
expiration. |
JAD rejected;
authentication failed. |
Installation not permitted. |
|
JAR signed.
Certificate path validated Signature verification
fails. |
JAD rejected;
authentication failed. |
Installation not permitted. |
|
JAR signed.
Certificate chain validated Signature verified. |
Authentication succeeded. |
Installation permitted; MIDlet suite assigned to the protection
domain associated with the corresponding protection domain root
certificate. |
18.5.3 Caching of
Authentication and Authorization Results
The authentication and authorization processes may store and
transfer their results for subsequent use. The MIDP implementation must protect
the cached information so that it cannot be tampered with or otherwise
compromised between the time it is computed and the time the authorization
information is used.
It is also essential that the MIDlet suite and security
information used to authenticate and authorize a MIDlet suite (that is, the raw
material for the authentication and authorization process) is not compromised.
This could happen, for example, if the implementation used removable media or
other MIDlet suite storage that might be corrupted.
18.5.4 X.509 Certificate
Profile for Trusted MIDlet Suites
Secured, trusted MIDlet suites use the same base certificate
profile as HTTPS. The profile is based on the WAP Certificate Profile,
WAP-211-WAPCert-20010522-a [reference 15] which is based
on RFC 2459 [reference 7]. See Section 16.4,
"MIDP X.509 Certificate Profile," for more information.
Certificate Processing for
Over-The-Air (OTA) Delivery
Devices must recognize the key usage field. When the field is
present, the device must verify that it has the digitalSignature bit
set.
Devices must recognize the critical extended key usage field.
When the field is present, the device must verify that the extension contains
the id-kp-codeSigning object identifier. (See RFC 2459 section 4.2.1.13
[reference
7].)
The application descriptor should not include a self-signed
root certificate in a certificate chain. However, MIDP devices should treat the
certificate as any other in a chain and not explicitly reject a chain that
contains a X.509v3 self-signed CA certificate.
Certificate Expiration and
Revocation
A device checks expiration and, optionally, revocation of
certificates supplied in the application descriptor during the authorization
procedure. A device can check for certificate expiration locally because it can
get the information from the certificate itself. Certificate expiration
verification is an intrinsic and mandatory part of certificate path
validation.
Certificate revocation is a more complex check, because a
device has to send a request to a server and make a decision based on the
response. A device can perform certificate revocation, but such mechanisms are
not part of MIDP implementation and hence do not form a part of MIDP 2.0
security framework. If a device implements certificate revocation, it should
support Online Certificate Status protocol (OCSP) [reference 8]. If other
certificate revocation protocols are supported, and they indicate that a
certificate has been revoked, the device may consider the certificate as revoked
regardless of the result returned by the OCSP protocol.
|