Blackberry Java Development Environment 4.6.0 Руководство - Страница 12

Просмотреть онлайн или скачать pdf Руководство для Программное обеспечение Blackberry Java Development Environment 4.6.0. Blackberry Java Development Environment 4.6.0 36 страниц. Cryptographic smart card driver

Cryptographic Smart Card Driver Development Guide
Task
Enable signing of unprocessed data.
See "Code sample: Enabling a CryptoToken object for RSA operations using a private key" on page 24 for more
information.

Store the location of the private key file

Even though the private key file is stored on the smart card, the BlackBerry device needs to know that a private key
file exists for a certificate. A class that implements the
pointer to a private key file on the smart card.
Task
Store the location of the private key file on
the smart card.
Associate the implementing class object
with the smart card that contains the
private key file.
Retrieve the ID of the smart card.
8
Steps
>
Perform one of the following steps:
To create a cryptographic smart card driver that is compatible with BlackBerry Device
Software Version 4.2 or later, create a method that signs unprocessed data, for example:
public void signRSA(RSACryptoSystem cryptoSystem,
CryptoTokenPrivateKeyData privateKeyData, byte[] input, int
inputOffset,byte[] output, int outputOffset)
throws CryptoTokenException, CryptoUnsupportedOperationException
{
signDecryptHelper(cryptoSystem, privateKeyData, input, inputOffset,
output, outputOffset, SIGN_DESC, SmartCardSession.SIGN_OPERATION);
}
To create a cryptographic smart card driver that is compatible with BlackBerry Device
Software Version 4.1 and Version 4.2 or later, and to include the cryptographic smart card
driver in two-factor authentication, create a method that signs unprocessed data, for example:
public void signRSASmartCardImpl (CryptoSystem cryptoSystem,
CryptoTokenPrivateKeyData privateKeyData, byte[] input,int
inputOffset, byte[] output, int outputOffset)
CryptoTokenPrivateKeyData
Steps
CryptoTokenPrivateKeyData
>
Implement the
1. Create an instance variable for storing the smart card ID.
private SmartCardID _id;
2. Create an instance variable for storing the location of the private key file on the smart card.
private byte _file;
3. Create a constructor that associates an object from the class that implements a
PrivateKeyData
interface with the smart card.
public MyCryptoTokenData(SmartCardID id, byte file)
{
_id = id;
_file = file;
}
>
Create a method that returns the
public SmartCardID getSmartCardID()
{
return _id;
}
interface can act as a
interface.
SmartCardID
instance variable.