Protect the SQLite database

Hi all

In my application, I have a database that must be protected with a key to restrict other apps on this device to access.

The problem is that I can't get the key signature at run time: whatever I do (...) 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 downloaded Signing Authority Tool and created a TEST.key use it and put it in {project_root}/keys/TEST.key in my Eclipse project

Also, I have TEST.key doule-click in Eclipse and class selected AbstractDB to be signed with it

I run my application on a real device, not in the Simulator

I run as follows

1. start debugging on a device - this introduces packaging and siging the .cod file. (However, in the signature tool window, I get a warning on my TEST.key: "Unregistered" and "please contact the signer and register with signing authority.")

2. with the signing authority tool, I sign my .cod file obtained in step 1 using my TEST.key

3. I click on debug on the device once more, sign tool signs the main .cod file again, and then the application will start on the device.

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

Do I did wrong

First of all, you need an instance of object in CodeSigningKey.get (...), like get (this). However, there is one thing, you should: If your object extends certain classes and/or implements interfaces, then ALL those who must be signed with the same key, in order to work. If no ancestor classes/interfaces is not signed, you get null.

This can be a problem if your hierarchy is deep enough. Information on classes are signed with keys that are stored in BlackBerry_App_Descriptor.xml and copied in the signature tool settings when you click on debug. It may happen that command line gets too long so the signing tool fails with the message "Invalid parameter" in the console.

So I extracted a class specially for the purposes of the signature:

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

    private SignatureClass(){}

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

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

PS: Also, if you move/rename the classes or the keys to verify this signature references in the BlackBerry_App_Descriptor.xml are valid. They are not being updated automatically.

Tags: BlackBerry Developers

Similar Questions

  • Encryption and Protection of SQLite database - App of signature with the Signature of Blackberry tool

    Hello

    I am trying to encrypt and protect my SQLite database. To do this, I have generated a pair of public/private key using the administration Blackberry signature tool. Then, I added the .key file to my project and written the code for encryption and data protection. Then, I signed the app with Blackberry signing authority tool such as mentioned in the documentation. It was duly signed. But my application does not work on the device. It shows that my application tries to access a secure API which means that it is not properly signed.

    What could be the problem?

    And also I want to know what is the difference between the signing of the "Tool of signed" app within the eclipse and sign the application with "Blackberry signing authority tool '?

    I sign my application with eclipse itself "tool of signed" before adding the public .key file and it worked very well.

    Please suggest.

    Thank you.

    You must sign with both.

  • How to find the SQLite database browser on an imac

    Where is the SQLite database browser on an iMac?

    Here, you can get a http://sqlitebrowser.org/

  • Is it possible to display the SQLite database?

    I can debug my app on my Playbook, but is it possible to display the SQLite database? I want to confirm it works.

    If you can recover on your PC/Mac, I use "Lita" SQLite DB management applications (its an AIR application).

  • Protect the unique database using clisterware under windows

    Hi all
    I'm looking for scripts for action protect the unique database (included, listener and vip) on a RAC clusterware on windows server 2003 (10 gr 2 version of RAC)
    I have already done on linux, but not on windows
    All oracle OTN action scripts are perl scripts wich use call system "px" unusable under Windows.
    Any who have already done this?
    Thanks for all your comments
    Concerning

    EasyTeam,
    Send me your email - I have Linux paper, that you reference the author.

    Philip...

  • view the contents of the sqlite database

    Hey

    Have created a sqlite database and entries stored in the database, I'm stuck all trying to display the contents of the database on the screen.

    I tried thi, but it does not work.

    Try
    {
    D database;
    Var myURI = URI.create ("file:///SDCard/Databases/SQLite_Guide/" +)
    "MyTestDatabase.db");
    d = DatabaseFactory.open (myURI, true);
    Statement st = d.createStatement ("SELECT * FROM data ;"); ")
    St.Prepare ();
    St.Execute ();
    St.Close ();
    d.Close ();
    }

    Can someone tell me please on how should I proceed?

    Thank you very much.

    Remove the rank r = c.getRow (); exposed outside the while loop and check.

    because, it is the 1st row in the result set is assigned to the r. If the query returns only one record, the while loop will not run.

    Before you ensure that the data are available in the table.

  • Rejection of the AppStore: location of the SQLite database

    I have an application that downloads data from the internet in a local SQLite database.

    Data are not generated for the user, and Apple has rejected my application because of it.

    The database may not be stored in/Documents /, but it should be stored in/Library/Caches /.

    How can I change this?

    http://www.saumitrabhave.com/2011/11/air-iOS-solving-apps-must-follow-iOS.html should help.

  • Unable to connect to the SQLite database in 9700

    Hi all, I have created a dt application dynamically retrieves data from a database stored locally Sqlite the strange thing is that this application works correctly on my 9800 and a friend 9930 but every time that the use of this app on 9700, it is impossible to connect to the database. Here is the code that I use to connect to the database (same code has been compiled and tested on all 3 devices):

    Connect to the database
    try {}
    Var myURI = URI.create("/store/home/user/documents/database.db");
    DB = DatabaseFactory.openOrCreate (myURI);
    } Catch (Exception e) {}
    If (db == null) {}
    Dialog.Alert ("unable to Access database');
    }

    Is there something on the 9700 device that I don't know? Because this code works on other devices... Help please.

    Finally, I discovered that it does not give the error if the database is stored on an SD card maybe 9700 does not support access sqlite on the memory of the device. Thanks for trying

  • Locations of the SQLite database

    Hi all

    IM developing an application that is run on OS 5.0 and more.  I know there is a limitation on what devices can store a database sqlite on the device itself.  I was wondering if anyone had a list of devices that support sqlite or where I could find it?  Also all os 5.0 do not come with the sd cards or bought them separately?

    Thanks in advance

    Hi zidane, please take a look at this thread

    http://supportforums.BlackBerry.com/T5/Java-development/persistent-storage-or-SQLite/TD-p/812739

    --

  • Using copyTo to copy the Sqlite database file to the directory of the user

    I am trying to copy my database Sqlite directory of private enforcement directory of documents accessible to the user. Here is my code:

    // closing db connection
    dbConnection.close();
    // clearing the db file variable
    dbFile = null;
    
    // new handle on the same db file
    dbFile = File.applicationStorageDirectory.resolvePath("mydb.db");
    // copy to documents directory
    dbFile.copyTo(File.documentsDirectory);
    

    When I try to run the code on the device, I get:

    There is an example on the Adobe AIR help page:

    original var = air. File.documentsDirectory.resolvePath ("AIR Test/test.txt");

    newFile var = air. File.documentsDirectory.resolvePath ("AIR Test/copy.txt");

    original.copyTo (newFile, true); true means crushes!

    Therefore, specify the new file name too not only the directory.

  • Select the query in the sqlite database

    Hello friends,

    I used this application in my application... It worked fine...

    Select fld_name in the limit of 0.10 tbl_placelist

    But when I used the query below, he showed me error...

    «Select fld_name in the limit of tbl_placelist «+ s1, 10»»

    I do not have how to pass two values (i.e) a global variable and an integer in the limit

    Can someone help me...

    Maybe I'm missing something but you want to say something like this:

    S1 int = 0;

    int s2 = 10;

    String q = 'select fld_name from tbl_placelist limit' + s1 + ', ' + 's2;


  • When sqlite database will be located in the Simulator.

    Hi all

    I wanted to get the location of the sqlite database file, but don't really know where it is located.

    Here is my code to create a database.

     QSqlDatabase database = QSqlDatabase::addDatabase("QSQLITE");
     database.setDatabaseName("./data/customerDatabase.db");
    

    Any help would be appreciatied.

    Oh, I think that I understand your question now.

    The db file will be updated

    //data/customerDatabase.db

    The com.example.quotes.testDev_mple_quotes19e3de88 file will be little difference in your Simulator. You must use the System target file browser (Windows--> views show others-->--> QNX target--> target file system browser) to navigate to this folder.   You should find the folder with the name of the started by your package declared in your bar - descriptor.xml name.

  • How to display a SQLITE database being created

    In my application Iam using the SQLITE database. I discovered the code how to create DB and create a disk etc. My question is:

    Is it possible to display dashboards created DB and its fields and records which is recorded in this table. I can't find any answer for this that I've seen to recover the data in the table by using queries and display in a listView, etc..

    Is it possible to display the SQlite DB tables and their fields and the saved recordings in their. Please help me out

    In Momentics choose View Navigator of the target file system. You can use 'copy to file system' to copy the database on your PC.
    On the PC, I use the Firefox "SQLite Manager" plugin to display and manipulate data. You can find it using the plugin manager.

  • Quick question: the database of the APEX can get synchronized with a SQLite database?

    Hi all!

    So, I'm an intern and I am applying in the APEX, and there's another student here who made the same request, but then for Android. It uses SQLite as a database (because it is a lightweight database), and I use the database to Oracle 11 g, which is used in the APEX. My request is already hosted online (via oracle.apex.com), so the database is online as well.

    Now, I have done some research, but I have never met a useful answer.

    Is someone here can tell me if this is really possible?
    As in, can synchronize my Oracle 11 g database and its SQLite database?

    Please, just a "Yes, it is possible", or a "no, won't it be able to do' will do. But if you say yes, and you also happen to know how, so any suggestions would be welcome. ;)

    I have 6 weeks to know, but I prefer to know in advance...

    Thanks for your response!

    Hello

    I think that your question do not relate in any case at the APEX. It is more related to data bases it self and connections.

    This might help
    Creating link to Sqlite db?

    Kind regards
    Jari

    -----
    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0

  • Problem with the size of sqlite database

    Hello

    I develop my first BB with BlackBerry Java Plugin application. This application has a comic more than 40 MB. The problem is I just proved think different and does not work.

    Option 1 - I shared database - but the Simulator will not work correctly.

    Option 2 - I compress with gzip, but when I try to decompress the Simulator database are not working properly.

    Option 3 - I divided database and compress each file, but the Simulator does not work.

    You have an idea how I can do?

    Thank you.

    Long ago, I got the right solution. I thought that this job has been closed. I will review. Thank you!

Maybe you are looking for

  • Browser features limited by memory

    I have a HP INVENT w / Intel (r) Core 2Quad Q800 and 6,00 GB. My pretains to problem of navigation on the internet. I use Google Chrome. If I open more than two pages of Google Chrome browser, I get a message from my provider of virus protection, AVG

  • Transplanting hard HP Elite SFF 8200, 8300 and vice versa

    Some time ago I asked a question on the transplantation of the hard drive of my HP 8200 desktop computer for my new HP 8300. As suggested, I installed files to controller hard drive before the drive, and almost everything seemed to work fine. (Window

  • Mini 110 and driver OfficeJet Pro 8500 wireless

    I have an OfficeJet Pro 8500 909 g installed a few months, and it works very well with three laptops from Dell and a Dell desktop computer using the wireless connection.  Then, I bought an HP Mini 110 and tried to install the drivers for the 8500 fro

  • When I came out of hibernation, a window appears saying that Windows is not genuine

    Windows not genuine message? I have a ZT Systems Core i7 PC with Win7 Home Premium 64-bit. It's about a year, but recently, when I came out of hibernation, a window appears saying that Windows is not genuine.  When I close and re - enter my ID in the

  • How can I stop the security warning, when running java in Internet Explorer?

    I am a Chief technician of this web application, and part of the present application has a Java Applet.  We have recently changed our signed certificates, on our servers, and now when a user that uses Java 1.7 or higher runs the Java Applet, they rec