Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Kiran_Snist
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified
Accepted Solution

Doubt regarding database Encryption

I m trying to do encrypt a database using signing key. I followed the procedure of generation of .key file from signing key tool of bb and created a GWL.Key file and tried using in my project , but i m getting Excelption ,though it is creating database succesfully.... Here is my code to encrypt the .db file :

 

DatabaseSecurityOptions dbso = new DatabaseSecurityOptions(false);
cardDetails = DatabaseFactory.create(uri,dbso);

 

CodeSigningKey codeSigningKey = CodeSigningKey.get(CodeModuleManager.getModuleHandle( "SQLite" ), "GWL");
	          
	            try
	            {
	                // Encrypt and protect the database.  If the database is already
	                // encrypted, the method will exit gracefully. 
	                DatabaseFactory.encrypt(uri, new DatabaseSecurityOptions(codeSigningKey));
	            }
	            catch(DatabaseException dbe)
	            {
	                Dialog.inform("Encryption failed - " + dbe.toString());         
	                
	            }

 

CodeModuleManager.getModuleHandle( "SQLite" )

the above line is returning "0" and i m getting IllegalArgumentexception on the below line:  

CodeSigningKey codeSigningKey = CodeSigningKey.get(CodeModuleManager.getModuleHandle( "SQLite" ), "GWL");
BlackBerry Development Advisor
MSohm
Posts: 14,864
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Doubt regarding database Encryption

Have you also signed your application with your custom key?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Kiran_Snist
Posts: 174
Registered: ‎01-25-2011
My Device: Not Specified

Re: Doubt regarding database Encryption

I have solved the issue.. Issue was with the module name... Thanx any way..