OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

com.ibm.opencard.signature
Class MFC40SigCodes

java.lang.Object
  |
  +--com.ibm.opencard.service.MFC35Codes
        |
        +--com.ibm.opencard.signature.MFC40SigCodes

public class MFC40SigCodes
extends MFC35Codes
implements MFCSigCodes

CLAss and INStruction codes for signature commands of MFC 4.0 and 4.21 smartcards. This class implements exactly the interface MFCSigCodes. Most methods are trivial and therefore not commented.

Version:
$Id: MFC40SigCodes.java,v 1.1 1999/12/02 16:06:08 damke Exp $
See Also:
MFCSigCodes

Fields inherited from class com.ibm.opencard.service.MFC35Codes
OP_UNKNOWN
 
Constructor Summary
MFC40SigCodes()
           
 
Method Summary
 void analyseStatus(int status, byte command, java.lang.Object context)
          Analyses the status of a smartcard's response to a key command.
 byte getCalculateHashByte()
          instruction byte for calculate hash
 int getEffectiveDataLength()
          Get the maximum effective data length for commands in key group.
 byte getFinishByte()
          P1 for finish stage of commands where the input data is provided to the card in several blocks
 byte getGenerateSignatureByte()
          instruction byte for generate signature
 byte getGenKeyByte()
          instruction byte for generate key pair
 byte getImportKeyByte()
          instruction byte for import key
 int getMaxInputBlockLength()
          The maximum input block length of the generate signature command for all key strengths and padding algorithms supported by the MFC 4.0 card.
 byte getPrepareByte()
          P1 for prepare stage of commands where the input data is provided to the card in several blocks
 int getPrepareHashInputLength(java.lang.String hashAlgorithm)
          get the maximum prepare hash command data input length for a given hash algorithm block length.
 byte getReadKeyInfoByte()
          instruction byte for read key info
 byte getValKeyByte()
          instruction byte for validate key
 byte getVerifySignatureByte()
          instruction byte for verify signature
 
Methods inherited from class com.ibm.opencard.service.MFC35Codes
getAG, getAskRandomByte, getBlockSize, getClassByte, getINS, getISOClassByte, getReadRecordByte, indicatesError, needsZeroLc, needsZeroLe, needsZeroLe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MFC40SigCodes

public MFC40SigCodes()
Method Detail

analyseStatus

public void analyseStatus(int status,
                          byte command,
                          java.lang.Object context)
                   throws CardServiceException
Analyses the status of a smartcard's response to a key command. If the command completed successfully, the method returns without further action. If an error occurred, an exception is thrown. This method uses indicatesError to determine whether an exception has to be thrown.
Parameters:
status - the status word returned by the smartcard
command - the INStruction sent to the smartcard
context - the context in which the command was issued
Throws:
CardServiceException - iff the status indicates an error
Overrides:
analyseStatus in class MFC35Codes
See Also:
MFC35Codes.indicatesError(int)

getCalculateHashByte

public byte getCalculateHashByte()
instruction byte for calculate hash
Specified by:
getCalculateHashByte in interface MFCSigCodes

getEffectiveDataLength

public int getEffectiveDataLength()
Get the maximum effective data length for commands in key group.
Specified by:
getEffectiveDataLength in interface MFCSigCodes
Returns:
int

getFinishByte

public byte getFinishByte()
P1 for finish stage of commands where the input data is provided to the card in several blocks
Specified by:
getFinishByte in interface MFCSigCodes

getGenerateSignatureByte

public byte getGenerateSignatureByte()
instruction byte for generate signature
Specified by:
getGenerateSignatureByte in interface MFCSigCodes

getGenKeyByte

public byte getGenKeyByte()
instruction byte for generate key pair
Specified by:
getGenKeyByte in interface MFCSigCodes
Returns:
byte

getImportKeyByte

public byte getImportKeyByte()
instruction byte for import key
Specified by:
getImportKeyByte in interface MFCSigCodes
Returns:
byte

getMaxInputBlockLength

public int getMaxInputBlockLength()
The maximum input block length of the generate signature command for all key strengths and padding algorithms supported by the MFC 4.0 card.
Specified by:
getMaxInputBlockLength in interface MFCSigCodes
Returns:
int

getPrepareByte

public byte getPrepareByte()
P1 for prepare stage of commands where the input data is provided to the card in several blocks
Specified by:
getPrepareByte in interface MFCSigCodes

getPrepareHashInputLength

public int getPrepareHashInputLength(java.lang.String hashAlgorithm)
get the maximum prepare hash command data input length for a given hash algorithm block length. The value must be an exact multiple of the Input Block Length for the hash algorithm being used and be below the maximum effective data length supported by the card.
Specified by:
getPrepareHashInputLength in interface MFCSigCodes
Parameters:
hashAlgorithm - algorithm for which the length should be returned
Returns:
int

getReadKeyInfoByte

public byte getReadKeyInfoByte()
instruction byte for read key info
Specified by:
getReadKeyInfoByte in interface MFCSigCodes

getValKeyByte

public byte getValKeyByte()
instruction byte for validate key
Specified by:
getValKeyByte in interface MFCSigCodes
Returns:
byte

getVerifySignatureByte

public byte getVerifySignatureByte()
instruction byte for verify signature
Specified by:
getVerifySignatureByte in interface MFCSigCodes