Thursday, April 2, 2015

No way to send/receive APDU to SmartCard Reader from W8.1?

Hi everybody,


with Windows Phone 8.1 you have the SmartCardConnection class through which you can send APDU to a smartcard (see below)




private async Task sendApduToReader()
{
string selector = SmartCardReader.GetDeviceSelector(SmartCardReaderKind.Generic);

DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(selector);

if (devices != null && devices.Count != 0)
{
SmartCardReader reader = await SmartCardReader.FromIdAsync(devices.First().Id);

IReadOnlyList<SmartCard> cards = await reader.FindAllCardsAsync();

if (cards != null && cards.Count != 0)
{
SmartCard card = cards.First();

//Here in W8.1 there is no ConnectAsync method and no SmartCardConnection class.
SmartCardConnection connection = await card.ConnectAsync();
var responseBuf = await connection.TransmitAsync(SOMEDATA);
}
}
}







In Windows 8.1 API there is no such class, so there is no way to send APDU to the smartcard.


Is there any workaround?


Many Thanks!


No comments:

Post a Comment