Help Center
Local Navigation
- Creating user interfaces
- Storing data
- Creating connections
- Managing applications
- Using custom messages and folders in the message list
- Applications for push content
- Localizing BlackBerry device applications
- Controlling access to APIs and application data
- Check if a code signature is required
- Java APIs with controlled access
- Register to use controlled APIs
- Restrictions on code signatures
- Request a code signature
- Register a signature key using a proxy server
- Sign an application using a proxy server
- View the signature status for an application
- Using keys to protect APIs and data
- Protect APIs using code signing keys
- Protect runtime store data using code signing keys
- Protect persistent data using code signing keys
- Testing a BlackBerry device application
- Packaging and distributing a BlackBerry Java Application
- Glossary
- Provide feedback
- Legal notice
BlackBerry Manuals & Help
>
Documentation for Developers
>
Java Development Guides and API Reference
>
Development Guide - BlackBerry Java Development Environment - 4.7.0
Protect persistent data using code signing keys
- Import the following classes:
- Create a hash ID for the object you want to store in a persistent object.
long MY_DATA_ID = 0x33abf322367f9018L; Hashtable myHashtable = new Hashtable();
- 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 ) );
- Make sure that the object is protected, invoke getContents using the CodeSigningKey object as a parameter.
Hashtable myHashtable = (Hashtable) persistentObject.getContents( key );
Parent topic: Controlling access to APIs and application data