SHOW Signed

net.rim.device.api.smartcard
Class ResponseAPDU

java.lang.Object
  |
  +--net.rim.device.api.smartcard.ResponseAPDU

public class ResponseAPDU
extends Object

Represents a response Application Protocol Data Unit. ISO 7816-4 defines the structure of the ResponseAPDU. The reponse contains two mandatory bytes called status words, SW1, SW2, preceeded by some data.

    +--------------------------------------+
    |           Data           | SW1 | SW2 |
    +--------------------------------------+
 

Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

Since:
JDE 4.1.0
See Also:
SmartCardReaderSession, SmartCardSession, CommandAPDU

Constructor Summary
 Category: Signed ResponseAPDU()
          Constructs a ResponseAPDU object.
 Category: Signed ResponseAPDU(byte[] data, byte sw1, byte sw2)
          Constructs a ResponseAPDU object, with response data and status words 1 and 2.
 
Method Summary
 Category: Signed  void appendData(byte[] data, byte sw1, byte sw2)
          Append the given data to the data portion of the response APDU
 Category: Signed  boolean checkStatusWords(byte sw1, byte sw2)
          Check to see if the passed in status words match the status words in the response.
 Category: Signed  byte[] getAPDU()
          Get the full Response APDU command, including the data, followed by the two status words.
 Category: Signed  byte[] getData()
          Returns a byte array representing the data component of the Response APDU.
 Category: Signed  byte getSW1()
          Returns a byte representing the first status word as defined in ISO 7816-4 5.4.5.
 Category: Signed  byte getSW2()
          Returns a byte representing the second status word as defined in ISO 7816-4 5.4.5.
 Category: Signed  void set(byte[] data, byte sw1, byte sw2)
          Sets the byte array representation of the object.
 Category: Signed  String toString()
          Returns a String representation of the object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResponseAPDU

public ResponseAPDU()
Constructs a ResponseAPDU object.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

ResponseAPDU

public ResponseAPDU(byte[] data,
                    byte sw1,
                    byte sw2)
Constructs a ResponseAPDU object, with response data and status words 1 and 2.

Parameters:
data - A byte array representing the response received. See ISO 7816-4 5.3.3.
sw1 - Status word one.
sw2 - Status word two.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.
Method Detail

appendData

public void appendData(byte[] data,
                       byte sw1,
                       byte sw2)
Append the given data to the data portion of the response APDU
Parameters:
data -
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

checkStatusWords

public boolean checkStatusWords(byte sw1,
                                byte sw2)
Check to see if the passed in status words match the status words in the response.
Parameters:
sw1 - The first status word
sw2 - The second status word
Returns:
true if the passed in status words match the status words in the response.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getAPDU

public byte[] getAPDU()
Get the full Response APDU command, including the data, followed by the two status words.

Returns:
The full response APDU.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getData

public byte[] getData()
Returns a byte array representing the data component of the Response APDU.

Returns:
A byte array containing the data component of the Response APDU. May return null, if the data has not been set.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getSW1

public byte getSW1()
Returns a byte representing the first status word as defined in ISO 7816-4 5.4.5.

Returns:
A byte representing status word one.
Throws:
IllegalStateException - Thrown if no data has been set for this response.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

getSW2

public byte getSW2()
Returns a byte representing the second status word as defined in ISO 7816-4 5.4.5.

Returns:
A byte representing status word two.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

set

public void set(byte[] data,
                byte sw1,
                byte sw2)
Sets the byte array representation of the object.

Parameters:
data - A byte array representing the response received. See ISO 7816-4 5.3.3.
sw1 - Status word one.
sw2 - Status word two.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.

toString

public String toString()
Returns a String representation of the object.

The String includes the the full response APDU ( data followed by the two status words ) in hex byte pairs

Overrides:
toString in class Object
Returns:
A String represention of the object.
Since:
JDE 4.1.0
Category:
Signed: This element is only accessible by signed clients. If you intend to use this element, please contact RIM to establish the necessary agreements that will allow you to have your COD files signed. Signing is only required for use on the device, development under the JDE can occur without signing the CODs.


Copyright 1999-2007 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.