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

com.ibm.opencard.service
Class MFCCommandAPDU

java.lang.Object
  |
  +--opencard.core.terminal.APDU
        |
        +--opencard.core.terminal.CommandAPDU
              |
              +--com.ibm.opencard.service.MFCCommandAPDU

public class MFCCommandAPDU
extends CommandAPDU

A re-usable command APDU for MFC smartcards. The secure messaging requires information about the direction of the data transfer, to determine whether the command, the response, or both have to be processed for PROtection or ENCryption. This class extends the base class by attributes and methods to set and query this information.
In the JavaDoc comments below, SM is used as an abbreviation for Secure Messaging. It refers to the cryptographic processing that is required to satisfy access contions that involve PRO or ENC.

Version:
$Id: MFCCommandAPDU.java,v 1.1 1999/12/02 16:06:08 damke Exp $

Fields inherited from class opencard.core.terminal.APDU
apdu_buffer, apdu_length
 
Constructor Summary
MFCCommandAPDU(byte[] buffer, int length)
          Instantiates a new, re-usable predefined command APDU for MFC smartcards.
MFCCommandAPDU(int size)
          Instantiates a new, re-usable command APDU for MFC smartcards.
 
Method Summary
 void appendBlock(byte[] data)
          Appends a data block to the APDU currently stored.
 void appendBlock(byte[] data, int offset, int length)
          Appends part of an array as a data block to the APDU currently stored.
 boolean isDataProvider()
          Queries the flag for SM relevant command data.
 boolean isDataRequester()
          Queries the flag for SM relevant response data.
 void setProviderFlag(boolean is)
          Sets the flag for SM relevant command data.
 void setRequesterFlag(boolean is)
          Sets the flag for SM relevant response data.
 
Methods inherited from class opencard.core.terminal.APDU
append, append, getBuffer, getByte, getBytes, getLength, setByte, setLength, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MFCCommandAPDU

public MFCCommandAPDU(int size)
Instantiates a new, re-usable command APDU for MFC smartcards. The provider and requester flags are set to false.
Parameters:
size - the maximum size of this command APDU
See Also:
setProviderFlag(boolean), setRequesterFlag(boolean)

MFCCommandAPDU

public MFCCommandAPDU(byte[] buffer,
                      int length)
Instantiates a new, re-usable predefined command APDU for MFC smartcards. The provider and requester flags are set to false.
Parameters:
buffer - the buffer to use for holding the APDU
length - the length of the APDU currently in the buffer
Throws:
java.lang.IndexOutOfBoundsException - length exceeds the size of the array buffer.
See Also:
setProviderFlag(boolean), setRequesterFlag(boolean)
Method Detail

setProviderFlag

public final void setProviderFlag(boolean is)
Sets the flag for SM relevant command data. If the flag is set to true, the command data will be subject to secure messaging operations.
Parameters:
is - whether the command includes SM relevant data
See Also:
isDataProvider()

setRequesterFlag

public final void setRequesterFlag(boolean is)
Sets the flag for SM relevant response data. If the flag is set to true, the expected response data will be subject to secure messaging operations.
Parameters:
is - whether the response will include SM relevant data
See Also:
isDataRequester()

isDataProvider

public final boolean isDataProvider()
Queries the flag for SM relevant command data. If this flag is true, and the access conditions require secure messaging, the command will be PROtected or ENCrypted.
Returns:
whether the command includes SM relevant data
See Also:
setProviderFlag(boolean)

isDataRequester

public final boolean isDataRequester()
Queries the flag for SM relevant response data. If this flag is true, and the access conditions require secure messaging, the response to this command will be expected to be PROtected or ENCrypted.
Returns:
whether the response will include SM relevant data
See Also:
setRequesterFlag(boolean)

appendBlock

public final void appendBlock(byte[] data)
                       throws java.lang.ArrayIndexOutOfBoundsException
Appends a data block to the APDU currently stored. The data block consists of a length byte, deduced from the length of the array passed as argument, and the data actually stored in the array. To append a byte array without the length byte, use append(byte[] data) in the base class.
If the buffer is not large enough to append the block, the buffer contents may get corrupted. An ArrayIndexOutOfBoundsException will be thrown in this case.
Parameters:
data - the data block to append
Throws:
java.lang.ArrayIndexOutOfBoundsException - the buffer is too small to hold the composed APDU

appendBlock

public final void appendBlock(byte[] data,
                              int offset,
                              int length)
Appends part of an array as a data block to the APDU currently stored. The data block consists of a length byte, followed by the actual data stored in the array. Appending a part of an array without a length byte is not supported. To append the complete array, use appendBlock(byte[]).
Parameters:
date - array holding the block to append
offset - index of the first byte of the block to append
length - length of the block to append
Throws:
java.lang.ArrayIndexOutOfBoundsException - the buffer is too small to hold the composed APDU
See Also:
appendBlock(byte[])