com.ibm.opencard.signature
Class MFC40KeyImpImpl
java.lang.Object
|
+--com.ibm.opencard.signature.MFC40KeyImpImpl
- public class MFC40KeyImpImpl
- extends java.lang.Object
- implements MFCKeyImportImpl
Helper class for implementation of a key import card service for MFC 4.0
and compatible.
Send APDUs to the card. The methods that send APDUs are synchronized
simply to reuse the APDU buffers.
- Version:
- $Id: MFC40KeyImpImpl.java,v 1.1 1999/12/02 16:06:08 damke Exp $
- See Also:
KeyImportCardService,
MFCKeyImportService
|
Method Summary |
protected MFCCommandAPDU |
getImpKeyAPDU(int keyNr,
byte[] data,
boolean isPrivate,
int offset,
int length,
boolean finish)
Create APDU for prepare or finish stage of import key command.
|
protected MFCCommandAPDU |
getValKeyAPDU(int keyNr,
int verKey,
byte[] signature,
boolean isPrivate)
Create APDU for validate key command |
void |
importKey(MFCCardChannel channel,
MFCKeyInfo ki,
byte[] data,
boolean isPrivate)
Send the command APDU for import key. |
boolean |
validateKey(MFCCardChannel channel,
int keyNr,
MFCKeyInfo ki,
byte[] signature,
boolean isPrivate)
Send the command APDU for validate key. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
mfcCodes
protected MFCSigCodes mfcCodes
- The CLAss and INStruction bytes for commands.
MFC40KeyImpImpl
public MFC40KeyImpImpl(MFCSigCodes codes)
- Instantiates a new key import service implementation.
- Parameters:
codes - the command codes for the MFC card to support
getImpKeyAPDU
protected MFCCommandAPDU getImpKeyAPDU(int keyNr,
byte[] data,
boolean isPrivate,
int offset,
int length,
boolean finish)
- Create APDU for prepare or finish stage of import key command.
Note: the block length must be less then the maximum effective data length of the card
- Parameters:
keyNr - key numberdata - the key data to be importedisPrivate - is it a private or a public keyoffset - offset into data for the current blocklength - length of current blockfinish - if set to false, return a prepare command APDU,
if set to true, return a finish command APDU.- Returns:
- com.ibm.opencard.service.MFCCommandAPDU
getValKeyAPDU
protected MFCCommandAPDU getValKeyAPDU(int keyNr,
int verKey,
byte[] signature,
boolean isPrivate)
- Create APDU for validate key command
- Parameters:
keyNr - key number of key to be validatedverKey - ken number of key to be used for signature verificationsignature - the signature over key keyNr that is to be verifiedisPrivate - key to be verified is a private or a public key- Returns:
- com.ibm.opencard.service.MFCCommandAPDU
importKey
public void importKey(MFCCardChannel channel,
MFCKeyInfo ki,
byte[] data,
boolean isPrivate)
throws CardServiceException,
CardTerminalException
- Send the command APDU for import key.
- Specified by:
- importKey in interface MFCKeyImportImpl
- Parameters:
channel - com.ibm.opencard.service.MFCCardChannelki - old key infodata - byte[] the key file dataisPrivate - true if a private key should be imported- Throws:
- CardServiceException - any subclass of CardServiceException
- CardTerminalException - any subclass of CardTerminalException
validateKey
public boolean validateKey(MFCCardChannel channel,
int keyNr,
MFCKeyInfo ki,
byte[] signature,
boolean isPrivate)
throws CardServiceException,
CardTerminalException
- Send the command APDU for validate key.
- Specified by:
- validateKey in interface MFCKeyImportImpl
- Parameters:
channel - com.ibm.opencard.service.MFCCardChannelkeyNr - number of key to be verifiedki - key info of key to be used for verification of signaturesignature - the signature to be verifiedisPrivate - true if a private key should be validated- Throws:
- CardServiceException - any subclass of CardServiceException
- CardTerminalException - any subclass of CardTerminalException
|