- ページ 22
ソフトウェア Blackberry Java Development Environment 4.6.0のPDF マニュアルをオンラインで閲覧またはダウンロードできます。Blackberry Java Development Environment 4.6.0 36 ページ。 Cryptographic smart card driver
Cryptographic Smart Card Driver Development Guide
return new MyRSACryptoToken();
}
throw new NoSuchAlgorithmException();
}
}
Code sample: Creating a cryptographic session for a
cryptographic smart card driver
Example: MyCryptoSmartCardSession.java
/**
* MyCryptoSmartCardSession.java
* Copyright (C) 2001-2007 Research In Motion Limited. All rights reserved.
*/
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
{
// We assume that the smart card has three certificates identified by: ID_PKI,
SIGNING_PKI
// and ENCRYPION_PKI. Your particular smart card may have a different number of
// certificates or be identified differently. These three certificates are merely an
example of
// what a smart card might contain.
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 = "Jason Hood";
private static final String ID_CERT = "ID Certificate";
private static final String SIGNING_CERT = "Signing Certificate";
private static final String ENCRYPTION_CERT = "Encryption Certificate";
18