ResponseAPDU

@objcMembers
public class ResponseAPDU : BaseClass

SmartCardIO - ResponseAPDU Class

A response APDU as defined in ISO/IEC 7816-4. It consists of a conditional body and a two byte trailer. This class does not attempt to verify that the APDU encodes a semantically valid response.

  • Initialiser; constructs a ResponseAPDU from a byte array containing the complete APDU contents (header and body).

    Throws

    StatusCode.invalidParameter if the APDU size is smaller than 2

    Declaration

    Swift

    @nonobjc
    public init(apdu: [UInt8]) throws

    Parameters

    apdu

    byte array containing the complete APDU contents (header and body).

  • Initialiser; constructs a ResponseAPDU from a byte array containing the complete APDU contents (header and body).

    Throws

    StatusCode.invalidParameter if the APDU size is smaller than 2

    Declaration

    Swift

    @objc
    public init(apduArray: [UInt8]) throws

    Parameters

    apduArray

    byte array containing the complete APDU contents (header and body).

  • constructs a ResponseAPDU from Data containing the complete APDU contents (header and body).

    Throws

    StatusCode.invalidParameter if the APDU size is smaller than 2

    Declaration

    Swift

    public init(apdu: Data) throws

    Parameters

    apdu

    Data containing the complete APDU contents (header and body).

  • Returns a copy of the bytes contained in this APDU.

    Declaration

    Swift

    public func getBytes() -> Data

    Return Value

    Data containing the APDU

  • Returns a copy of the data bytes in the response body.

    Declaration

    Swift

    public func getData() -> Data

    Return Value

    APDU data bytes

  • Returns the number of data bytes in the response body (Nr) or 0 if this APDU has no body.

    Declaration

    Swift

    public func getNr() -> UInt32

    Return Value

    Number of data bytes in the response body (Nr)

  • Returns the value of the status bytes SW1 and SW2 as a single status word SW.

    Declaration

    Swift

    public func getSW() -> UInt16

    Return Value

    Status bytes SW1 and SW2 as a single status word SW.

  • Returns the value of the status byte SW1 as a value between 0 and 255.

    Declaration

    Swift

    public func getSW1() -> UInt8

    Return Value

    status byte SW1 as a value between 0 and 255

  • Returns the value of the status byte SW2 as a value between 0 and 255.

    Declaration

    Swift

    public func getSW2() -> UInt8

    Return Value

    status byte SW2 as a value between 0 and 255

  • Returns a string representation of the response APDU

    Declaration

    Swift

    public func toString() -> String

    Return Value

    String representation of the response APDU