We have developed an application in Blackberry 8830. And we have stored the data in the Persistent Store. However, we would like to use some protection mechanism to secure the data.
We were using the following code :
try{
codeSigningKey = codeSigningKey.get(ApplicationDescri开发者_JAVA百科ptor.currentApplicationDescriptor().getModuleHandle(), 1234);
_bill=new Vector();
_bill=vtr;
synchronized(billing)
{
billing.setContents(new ControlledAccess(_bill, codeSigningKey));
billing.commit();
}
}
catch(ControlledAccessException cae){
System.out.println("Signing keys does not match: No Autorization to access data . ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
}`
How could we protect the data by using the above mechanism, or some other way?
To protect data you should use ContentProtectedHashtable
or ContentProtectedVector
as a container for your data instead of a plain Vector
from your code sample. Then the container is put into the PersistentObject
. Those containers have reCrypt()
method that enables protection.
You should also know that to be able to use this approach you have to sign your app with your self-created key (the one that is referred as codeSigningKey
in your code sample). For this you need to start another RIM tool - password-based file signer, point it to your .cod file and provide the password to access your key. Also note this key should be added to project resources.
精彩评论