On Palm OS, applications are automatically shut down by the system whenever a user switches to a different application. Therefore, if you encrypt an UltraLite database on Palm OS, the user is prompted to re-enter the key each time they switch back to the application.
Save the encryption key in dynamic memory as a Palm feature.
Features are indexed by creator and a feature number. Applications can then pass in their creator ID or NULL, along with the feature number or NULL, to save and retrieve the encryption key.
Program the application to retrieve the key upon re-launch.
Because the encryption key is cleared on any reset of the device, the retrieval of the key will fail at this time. The user is prompted to re-enter the key in this case.
The following sample code (embedded SQL) illustrates how to save and retrieve the encryption key:
startupRoutine() { ul_char buffer[MAX_PWD]; if( !ULRetrieveEncryptionKey( buffer, MAX_PWD, NULL, NULL ) ){ // prompt user for key userPrompt( buffer, MAX_PWD ); if( !ULSaveEncryptionKey( buffer, NULL, NULL ) ) { // inform user save failed } } } |
Use a menu item to clear the encryption key and thereby secure the device.
The following code sample shows the method to accommodate this goal:
case MenuItemClear ULClearEncryptionKey( NULL, NULL ); break; |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |