SecureElementChannel.Transmit Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Transmit an APDU (Application Protocol Data Unit) command to the Secure Element. The system ensures that only one APDU is sent to the Secure Element at a time.

Namespace:  Microsoft.Phone.SecureElement
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)

Syntax

Public Function Transmit ( _
    command As Byte() _
) As Byte()
public byte[] Transmit(
    byte[] command
)

Parameters

  • command
    Type: array<System..::.Byte>[]()[]
    The command to be transmitted to the Secure Element. Maximum size, including header, is 261 bytes.

Return Value

Type: array<System..::.Byte>[]()[]
The response APDU from the Secure Element. This has a maximum length of 255 bytes.

Exceptions

Exception Condition
IOException

Unable to communicate with the Secure Element.

COMException

Unable to communicate with the Secure Element.

ArgumentException

The length of the command byte array is less than 4 bytes.

-or-

The length of the APDU is not coherent with the length of the command.

InvalidOperationException

The channel is not open and cannot be used.

UnauthorizedAccessException

The command is not allowed.

Remarks

The returned byte array is the APDU response from the Secure Element. The last two bytes are sw1 and sw2, the status code bytes.

When using the Transmit method, please note the following:

  • The MANAGE_CHANNEL command is not allowed and will throw an exception.

  • SELECT by DF Name commands are not allowed and will throw an exception.

  • CLA bytes with channel numbers are de-masked

Version Information

Windows Phone OS

Supported in: 8.1, 8.0

See Also

Reference

SecureElementChannel Class

Microsoft.Phone.SecureElement Namespace