Troubleshooting guide

101
5: Using smart cards
Activate libMain() on startup
Create a session for the smart card driver
Code sample: Creating a smart card session
Example: MyCryptoSmartCardSession.java
/**
* MyCryptoSmartCardSession.java
* Copyright (C) 2001-2005 Research In Motion Limited. All rights reserved.
Task Steps
Create a libMain() method. > In your extension of the CryptoSmartCard class, implement the libMain() method.
Run the libMain() method when the
application starts.
1. Open the BlackBerry® Integrated Development Environment.
2. Create a new project for the smart card driver.
3. In the Workspace window, right-click the new project.
4. Select Properties.
5. On the Application tab, in the Project type field, type Library.
6. Make sure that the Auto-run on startup check box is selected.
7. In the Startup Tier field, select the 7(Last; 3rd party apps only) option.
8. Click OK.
Task Steps
Create a smart card session. > Extend the abstract CryptoSmartCardSession class.
Close a smart card session. > Implement SmartCardSession.closeImpl().
Retrieve the maximum
number of login attempts.
> Implement SmartCardSession.getMaxLoginAttemptsImpl().
Retrieve the smart card ID. > Implement SmartCardSession.getSmartCardIDImpl().
Retrieve the remaining
number of login attempts.
> Implement SmartCardSession.getRemainingLoginAttemptsImpl().
Attempt to log the
BlackBerry® device user into
the smart card session using
a given password string.
> Implement SmartCardSession.loginImpl(String).
Retrieve the key store data
that is associated with the
keys.
> Implement CryptoSmartCard.getKeyStoreDataArrayImpl().
Retrieve random data from
the internal random number
generator of the smart card.
> Implement CryptoSmartCard.getRandomBytesImpl(int maxNumBytes).