Using code signing keys to restrict access to packages or classes in a BlackBerry library project

You can help protect the packages and the classes in your BlackBerry® library project by using your own code signing key. For more information about the code signing process visit www.blackberry.com/go/devguides to see the BlackBerry Signing Authority Tool Version 1.0 - Password Based Administrator Guide.
Note: You can help protect a package or a class with only one private key at a time.
Before you begin: You must have a key pair (public key and private key). You can get a key pair by using the BlackBerry Signing Authority Tool. To download the BlackBerry Signing Authority Tool visit www.blackberry.com/developers/downloads.
  1. Complete one of the following tasks:

    Task

    Steps

    Copy a public key (.key) into your BlackBerry library project.

    1. In the Package Explorer view, copy and paste the private key into the /src folder of your BlackBerry library project.
    2. Double-click the private key to open the key editor.

    Import a public key (.key) into your BlackBerry library prloject.

    1. On the File menu, click Import.
    2. Expand General and click File System.
    3. Click Next.
    4. In the From directory dialog box, click Browse. Navigate to the location of the private key and click OK.
    5. In the right-hand pane, select the private key.
    6. In the Into folder dialog box, click Browse and navigate to the location of the /src folder of your BlackBerry library project.
    7. Click the src folder and click OK.
    8. Click Finish.
    9. Double-click the private key to open the key editor.

    Link a public key (.key) to your BlackBerry library project.

    1. In the Package Explorer view, right-click the /src folder of your BlackBerry library project.
    2. Click New > File.
    3. Click Advanced.
    4. Select the Link to file in the file system option.
    5. Click Browse to navigate to the location of the private key and click Open.
    6. Click Finish.

    The key editor opens automatically.

  2. In the key editor, select the package or class that you want to restrict access to.
  3. Close the key editor and click Save.
  4. Package your BlackBerry library project. Access to the .cod file that is created is restricted at runtime.
After you finish:

When a BlackBerry device application accesses a package or a class that is protected in the BlackBerry library project, the application's .cod file must be signed with the same private key as the package or class. You can sign the .cod file with the private key by using the File Signer tool in the BlackBerry Signing Authority Tool.


Was this information helpful? Send us your comments.