Search |
||
Developing MEP Client Applications - Part 2Posted by ryan_shoemaker on February 23, 2009 at 1:10 PM PST
Part 1 of this series focused on the core features of the MCBO API. In Part 2, we will see how to take advantage of many of the client security features provided in the API, using the MusicDB sample app as a framework for the discussion. I've stripped all of the UI related code from the sample fragments, but I did need to include some pseudo code in a few places to clearly illustrate some of the concepts.
Review of MCBO Security FeaturesThe security features in SGMP v1.1 haven't changed much since MEP 1.0. The only new addition is an AES based security manager.Here's a rundown of the security features we'll be exploring:
Security ManagersThe core class that provides all of the security features in the MCBO API isSecurityManager. This class is abstract so that application developers have the option to provide their own implementation. The MCBO API ships with two SecurityManager implementations: DefaultSecurityManager and AESSecurityManager. The DefaultSecurityManager class shipped as part of MEP 1.0 and provides Triple-DES encryption. The AESSecurityManager is a new addition to SGMP 1.1 and provides AES encryption.
To enable security in your MCBO client, you simply have to pass an instance of In this sample, we are using a 3DES-based default security manager. The "musicdb" parameter passed to the constructor is a unique application specific context name that the MCBO library will use to store security related data in RMS on the device.
AuthenticationThere are two layers of user authentication - one at the application layer (which is optional) and another at the synchronization layer (which is mandatory).
Application authentication provides a login mechanism that prevents unauthorized users from launching the application and gaining access to sensitive information. The
In this example, the "pin" is a plaintext alphanumeric string entered by the user on the UI. The isPinSet API determines if this is the first time the user is logging into the application. If so, then it is necessary to set the pin. Setting the pin requires the user to enter a "secret" which is also a plaintext alphanumeric string. Entering the secret is only done once and the user does not need to remember it - it should be a long random sequence of key presses on the device. The purpose of the secret is to calculate a derivative of the pin, so the pin isn't stored directly on the device. Once the pin and secret are entered a key is calculated (the MD5 hash of the pin) and the credential derivatives are stored in RMS via the storeCredentials API. If this isn't the first time the user is logging into the application, then the key is calculated from the pin and the security derivatives stored in RMS are retrieved and used to authenticate the pin with the validatePin API. In either case, once the user has successfully authenticated themselves, the MD5 hash of the pin becomes the key used for encrypting data at rest on the device by calling the setKey API.
Synchronization layer authentication is orthogonal to Application layer authentication and is not managed by
Data EncryptionOnce you've enable client security (by passing an instance ofSecurityManager into your SyncManager constructor), encryption of data at rest on the device happens automatically. The application developer doesn't need to write any special code to handle the encrypted data. The MCBO API will automatically decrypt/encrypt data when reading/writing business objects from/to the device filesystem. Furthermore, it will handle encryption/decryption of the records as they are received/sent to the gateway sync engine.
Transport Layer SecurityTLS is provided by using HTTPS connections between the mobile device and the MEP gateway server. Because the synchronization layer credentials are visible on the wire and only minimally protected with MD5, https connections should be used to protect transmissions over the air. There are no specific APIs to enable the use of https - you simply configure your mobile device and gateway servers to use https and specify the sync url using https protocol.
Data DestructionMCBO provides the ability for applications to perform complete data destruction under certain circumstances. The application developer may decide to wipe-out all data if the user fails a certain number of login attempts or after a certain amount of time has passed without a successful synchronization.To initiate data destruction:
Since you can use the same security manager instance with multiple sync managers, you need to tell it which class of business objects to destroy.
Lock OutApplication developers can specify a maximum number of login attempts. If a user exceeds the threshold, then they are locked out of the application. For example:
In this case, the user has 5 login attempts. On the 6th and subsequent failures, the call to
Data FadingA quiet period can be specified that allows the application to determine if a device is lost. After the quiet period expires, the application can take whatever protective measures it chooses (such as data destruction). For example, if you expect your mobile users to sync at least once a week, you could set a two-week quiet period after which an invalid pin entry would trigger data destruction:
Data fading is disabled by default. To enable it you specify a positive quiet period in ms and to disable it, you specify 0. The clock is reset every time a successful sync occurs.
ExtensibleAs I pointed out above, the MCBOSecurityManager is an abstract class so developers are free to supply their own implementations based on whatever cyrpto library they choose.
ConclusionWe've covered almost all of the security features offered in the MCBO API in Part 2 of this series. One of the things I hoped you would take away from this discussion is how flexible the security features are in the MCBO API. It doesn't dictate a security policy (in fact, you don't have to use security in your applications at all), but rather it provides a framework that allows you to fine-tune your own security policy by using the features you need and ignoring the rest.»
Related Topics >>
Glassfish Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|