Blackberry Java Development Environment 4.6.0 Manual - Halaman 19
Jelajahi secara online atau unduh pdf Manual untuk Perangkat lunak Blackberry Java Development Environment 4.6.0. Blackberry Java Development Environment 4.6.0 36 halaman. Cryptographic smart card driver
Code samples
Code sample: Creating a cryptographic smart card object
Code sample: Creating a cryptographic session for a cryptographic smart card driver
Code sample: Enabling a CryptoToken object for RSA operations using a private key
Code sample: Storing the location of a private key file on the smart card
Code sample: Creating a cryptographic smart card object
Example: MyCryptoSmartCard.java
/**
* MyCryptoSmartCard.java
* Copyright (C) 2001-2007 Research In Motion Limited. All rights reserved.
*/
package com.rim.samples.device.smartcard;
import net.rim.device.api.smartcard.*;
import net.rim.device.api.util.*;
import net.rim.device.api.crypto.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.system.*;
/**
* This class represents a kind (or model or family) of a physical smart card.
* There should only be one instance of this class in the system at one time. The instance
* is managed by the SmartCardFactory.
*/
public class MyCryptoSmartCard extends CryptoSmartCard implements Persistable
{
private final static byte MY_ATR [] = { (byte)0x3b, (byte)0x7d, (byte)0x11,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x31,
(byte)0x80, (byte)0x71, (byte)0x8e, (byte)0x64,
(byte)0x86, (byte)0xd6, (byte)0x01, (byte)0x00,
(byte)0x81, (byte)0x90, (byte)0x00 };
private final static AnswerToReset _myATR = new AnswerToReset( MY_ATR );
private static final String LABEL = "RIM Sample";
private static final String DISPLAY_SETTINGS = "Show driver properties/settings now";
private static final String RSA = "RSA";
/**
* This method is invoked when the BlackBerry device starts and registers this
* cryptographic smart card driver with the smart card factory.
* Registering this cryptographic smart card driver with the smart card factory
* automatically registers the cryptographic smart card driver with the user
* authenticator framework which allows the smart card to be used as a second factor of
3