07-06-2012 11:39 AM
I'm developing a Cordova (1.9.0) App for Blackberry that need to access a smart card inserted into a BlackBerry SmartCard Reader v2.0.
Given that the smart card I'm trying to connect to is not one of the originally supported by BlackBerry (SafeNet 330, PIV, nor GSA CAC), I needed to implement my own smart card driver. In order to do so, I extended the net.rim.device.api.smartcard.* classes CryptoSmartCard, CryptoSmartCardSession, RSACryptoToken and CryptoTokenPrivateKeyData.
On a native blackberry app, I make a new "Library" project on Eclipse (using the BlackBerry Eclipse Plugin and modifying the "BlackBerry_App_Descriptor.xml" file) and then I reference it on the classpath of a native blackberry app in order to test/use it. I tried this way and worked. The driver registered itself properly, and I managed to see my smart card name on the list of supported smart cards under Options->Security->Smart Card->Registered Card Drivers. Then I could access the smart card with my native application.
Instead, on a Cordova\Web Works project, using ant for development, I managed to make a Cordova Plugin (adding the plugin source files inside "cordova.1.9.0.jar" and adding the plugin to the plugins list on "plugins.xml") in order to access the smart card functionality. I managed to open a session on the smart card with the generic method SmartCardFactory.getSmartCardSession(), but I could not open my proprietary smart card session, or use my proprietary methods of the driver.
I could not find a way to add a reference to my smart card driver project. Is this possible? In the blackberry native app, with eclipse, I just needed to modify the classpath of the project and add a reference to the driver project, but here I only have the "project.properties" file and the "config.xml" file. Or should I implement my driver as a WidgetExtension like the Cordova Project and make my own .jar?
Thanks in advance,
07-09-2012 02:48 PM
Yes, it does feel like an extension, based off the WidgetExtension class, that makes use of an external library is what you are looking for.
For WebWorks, I'm aware of the foloowing extension in Github right now that uses this approach. The Analytics API, uses a 3rd party library, to provide live WebTrends-powered analytics services. The code in this folder shows how to configure and consume this extension correctly:
It may be a good model for you to follow to create your own Smart Card extension?