Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6377907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:56:07+00:00 2026-05-25T01:56:07+00:00

In my app I have a database which must be protected with a key

  • 0

In my app I have a database which must be protected with a key to restrict other apps on this device from accessing it.

The problem is that I cannot get the signing key in runtime: whatever I do the CodeSigningKey.get(...) always returns null.

This is my code:

    final CodeSigningKey key = CodeSigningKey.get(AbstractDB.class);
    if (key != null) {
        Log.d("+ GOT SIGNING KEY");
        final DatabaseSecurityOptions secopt = new DatabaseSecurityOptions(key);
        db = DatabaseFactory.create(name,  secopt);
    } else {
        Log.d("- SIGNING KEY IS NULL");
    }

I have downloaded Signing Authority Tool and created a TEST.key using it, and put it in {project_root}/keys/TEST.key in my Eclipse project.

Also, I’ve doule-clicked TEST.key in Eclipse and selected AbstractDB class to be signed with it.

I run my app on a real device, not in the simulator.

I run it as follows:

  1. start debugging on a device – this initiates packaging and siging the .cod file. (However, in the signing tool window I get a warning about my TEST.key: “Not registered” and “Please contact the signer and register with the Signing Authority.”)

  2. with Signing Authority Tool I sign my .cod file obtained on step 1 using my TEST.key

  3. I click debug on device once again, and the signing tool signs the main .cod file again, and then the app starts on the device.

However, the key I get from CodeSigningKey.get(..) is always null.

What do I do wrong?

Solution

After a hint from Michael I was able to resolve this problem.

First of all, indeed I needed an object instance in CodeSigningKey.get(...). However, there is one thing you should aware of: if your object extends some classes and/or implements some interfaces, then ALL of those must be signed with same key in order to work. If any of ancestor classes/interfaces is not signed you will get null.

This can be a problem if your hierarchy is deep enough. Information about which classes are signed with which keys is stored in BlackBerry_App_Descriptor.xml, and copied into parameters of signing tool when you click Debug. It may happen that command line gets too long so the signing tool fails with “Invalid parameter” message in the console.

So I’ve extracted a class specially for the signing purpose:

final public class SignatureClass {
    private static final SignatureClass INSTANCE = new SignatureClass();

    private SignatureClass() { }

    public static CodeSigningKey getKey() {
        return CodeSigningKey.get(INSTANCE);
    }
}

I sign only this class with my key and use SignatureClass.getKey() to get the key.

PS: Also, if you move/rename classes or keys check that signing references in the BlackBerry_App_Descriptor.xml are valid. They aren’t updated automatically.

Update

How to issue your own signing key properly.

In the process I’ve described above I had to sign the .cod file with a separate tool because the built-in signing tool gave error “Not registered” for my TEST.key. In order to fix this and have your .cod signed automatically in one go, do following steps.

  1. After you have created your key with Signing Authority Tool, launch the WebAdmin utility included in that app. It offers you to create the keys database and launch the WebSigner service.

  2. Having successfully started the WebAdmin, click menu Record->Add. You’ll get a window where you can create a .csi file. Configure: number of requests – infinite; expiry date – never; email notifications – none; email CSI file – no. Click OK and you’ll see a dialog with a generated PIN – save it for future use. The .csi file is generated and saved in /data folder in Signing Authority Tool.

  3. Install the .csi file using Eclipse->Window->Preferences->BlackBerry plugin->Signature Tool->Install new keys and register it using the PIN from step 2.

Done. From now on, when signing with RIM keys you’ll have your .cod automatically signed also with your key.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:56:07+00:00Added an answer on May 25, 2026 at 1:56 am

    I believe you need an object instance from your app, instead of a class object. In this case ‘this’ ought to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that must get data from the Sqlite database in order
I have a web-app-database 3 tier server setup. Web requests data from app, and
I have an app that needs to check a database table every minute. The
I have a simple app that uses an SQL Express 2005 database. When the
In my qt app I have this object, filled before setting up my QTreeWidget's
In my app have a window splitted by a QSplitter, and I need to
On my rails app I have a list of items (like a task list)
For my Django app I have Events, Ratings, and Users. Ratings are related to
In my app I have 2 divs, one with a long list of products
While developing my app I have come to realize that the majority of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.