•
net.rim.device.api.system.RuntimeStore
2.
Create a hash ID for the object you want to store in the runtime store.
long MY_DATA_ID = 0x33abf322367f9018L;
Hashtable myHashtable = new Hashtable();
3.
Store the object in the runtime store and protect the object with the
CodeSigningKey
object. Only applications signed
with the key can read or change the object.
RuntimeStore.put( MY_DATA_ID, new ControlledAccess( myHashtable, key ) );
4.
Make sure that the object is protected with a particular code signing key, invoke
RuntimeStore.get
, providing as
parameters the hash ID for the object and the
CodeSigningKey
object.
Protect persistent data using code signing keys
1.
Import the following classes:
•
java.util.Hashtable
•
net.rim.device.api.system.PersistentObject
2.
Create a hash ID for the object you want to store in a persistent object.
long MY_DATA_ID = 0x33abf322367f9018L;
Hashtable myHashtable = new Hashtable();
3.
Store the object in the persistent object and protect the object with the
CodeSigningKey
object. For example, after
a BlackBerry device application runs the following line of code, only code files that are signed with the RSAE .key file can
read or overwrite the object in the persistent object.
persistentObject.setContents( new ControlledAccess( myHashtable, key ) );
4.
Make sure that the object is protected, invoke
getContents
using the
CodeSigningKey
object as a parameter.
Hashtable myHashtable = (Hashtable) persistentObject.getContents( key );
Development Guide
Protect persistent data using code signing keys
86