Pin Me

How to Start Developing Java applications for BlackBerry Devices: Signing Keys

written by: crisbbdev•edited by: Simon Hill•updated: 6/29/2010

This article explains how to configure your eclipse IDE with the signing keys so as to be able to use restricted APIs in device applications. You will learn how to get the signing keys and how to register them using the Signature tool.

  • slide 1 of 2

    APIs and Signing Keys

    This article explains what the restricted APIs are and how to deal with them.

    Before starting to program complex applications and test them on your mobile you should know that there are some API’s classes and methods that are controlled by RIM. This means that RIM wants to have some statistics about when and where are these APIs are used. So you need to get what is call “Signing keys” and provide your IDE with them so as to build a .cod which later can be installed on a device (if you’re testing on a simulator, you won’t need these signing keys).

    There are three types of APIs which require the .cod to be signed:

    1. Runtime APIs
    2. BlackBerry Application APIs
    3. BlackBerry Cryptography APIs

    (There is some functionality that also requires the .cod to be signed, for example an auto-star application…)

    Depending on the API class you are using your will application get one of these two verification types:

    • Linktime verification: This is produced when you load your application in the device. If your application is not properly signed, you won’t be able to put it on your device.
    • Runtime verifications: These are made when your app tries to use one API which needs to be signed. These runtime verifications will throw a Java exception in your code (ControlledAccessException).
  • slide 2 of 2

    Signing process

    Get your signing keys

    In order to properly sign your future applications you first need to get your own signing keys. You have to fill in and send the following form and pay $20. In less than 5 days you should receive a RIM mail with your keys attached and a PIN number to register them. If you unzip the attached file, you will see three .csi files (one for each API type which needs to be signed).

    Configure your eclipse IDE to use the keys

    Now let’s put our keys in our Eclipse environment. Open the Eclipse environment we installed in previous articles and go to Window>Preferences>BlackBerry Java Plug-in. There you have some signing configuration options. Warnings, for example, let you see which classes need to be signed while you’re writing code. The option we are looking for is Signature Tool.

    The Signature Tool is a tool which comes integrated with our IDE which allows us to easily sign our code. To properly configure it we need to register our .csi received files following these steps.

    Put the .csi received files in the following directory:

    eclipse\plugins\net.rim.eide.componentpack[version]\components\bin

    Now open the signature tool as we explained before and click “install new keys” and look for and select one of the three .csi files. A dialog box will be shown saying that the private key doesn't exist. Say “Yes” to create a new one. Type a new password and remember it because it will be asked for every time you sign .cod files in the future. After that you will be asked to provide the PIN that RIM gave you along with the keys (check the received file). Repeat this process with the two .csi files remaining.

    Congratulations! Your IDE is correctly configured to sign .cod files. You can sign them manually or check the option “Automatically sign .cod files after packaging”.