Troubleshooting guide
102
BlackBerry Java Development Environment Development Guide
*/
package com.rim.samples.device.smartcard;
import net.rim.device.api.crypto.*;
import net.rim.device.api.crypto.certificate.*;
import net.rim.device.api.crypto.certificate.x509.*;
import net.rim.device.api.crypto.keystore.*;
import net.rim.device.api.smartcard.*;
import net.rim.device.api.util.*;
/**
* This class represents a communication session with a physical smart card.
*
* Over this session, Application Protocol Data Units may be exchanged with the smart card
* to provide the desired functionality.
* Do not hold open sessions when not using them; they should be short-lived.
* As a security precaution, only one open session is allowed to exist per SmartCardReader;
* subsequent openSession() requests will block until the current session is closed.
*/
public class MyCryptoSmartCardSession extends CryptoSmartCardSession
{
public static final byte ID_PKI = (byte)0x00;
public static final byte SIGNING_PKI = (byte)0x01;
public static final byte ENCRYPTION_PKI = (byte)0x02;
private static final String WAITING_MSG = “Please Wait”;
private static final String ID_STRING = “John H. Smith”;
private static final String ID_CERT = “ID Certificate”;
private static final String SIGNING_CERT = “Signing Certificate”;
private static final String ENCRYPTION_CERT = “Encryption Certificate”;
/**
* Construct a new MyCryptoSmartCardSession object.
*
* @param smartCard Smart card associated with this session
* @param readerSession Reader session commands sent to this smart card.
*/
protected MyCryptoSmartCardSession( SmartCard smartCard, SmartCardReaderSession
readerSession )
{
super( smartCard, readerSession );
}
/**
* Close this smart card session.
*
* Implementations should not close the underlying SmartCardReaderSession. Use this
* method for cleaning up the session prior to its closure.
*/
protected void closeImpl()
{
// Do any session cleanup needed here.
}
/**
* Retrieve the maximum number of allowed login attempts.