net.rim.device.api.smartcard
Class ResponseAPDU

java.lang.Object
  extended by 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 |
    +--------------------------------------+
 

See Also:
SmartCardReaderSession, SmartCardSession, CommandAPDU
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

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.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0


Method Detail

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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

getAPDU

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

Returns:
The full response APDU.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

appendData

public void appendData(byte[] data,
                       byte sw1,
                       byte sw2)
Append the given data to the data portion of the response APDU.

Parameters:
data -
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal