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

    Question

  • 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!

    Wednesday, April 1, 2015 3:13 PM

All replies

  • Hi Nicolov,

    Try this: SmartCardConnection class, TransmitAsync | transmitAsync method is what you need for APDU data.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, April 2, 2015 9:26 AM
    Moderator
  • Thanks James, but your solution is my problem. O_O

    Any suggestion?

    Thursday, April 2, 2015 3:04 PM
  • Oops, sorry, misunderstand your previous question :)

    Yes, the API only works on Windows Phone 8.1 but not work on Windows Store App, and there seems no equivalent method that can do it.  I also found some comments from: http://channel9.msdn.com/Events/Build/2013/2-041#c635084018346669735, only Win32 applications can send APDU commends to SmartCardDevice.

    On the other side, if we want to make things ready, we need to create our own wrapper, I found an interesting blog that you can follow: http://www.codeproject.com/Articles/540839/Using-Smart-cards-with-a-Windows-Store-App

    Hope helps.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 3, 2015 3:35 AM
    Moderator
  • Many thanks!

    The code on that blog misses an important field of the APDU command:

    Ins = apduCmd.Ins,

    P1 = apduCmd.P1,

    P2 = apduCmd.P2,

    Le = apduCmd.Le,

    Data = apduCmd.Data

    Lc is missing (it indicates how many bytes the data field contains)

    I don't know why MS doesn't want to implement the APDU transmission for Windows Store App :-(

    Best regards!

    Tuesday, April 7, 2015 4:34 PM
  • Hi NicoloV,

    Sorry I cannot comment for that but it could be a good idea to raise your suggestion to our product team: https://wpdev.uservoice.com/forums/110705-dev-platform

    Thanks for your understanding,

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 8, 2015 5:41 AM
    Moderator
  • Another idea, perhaps you can follow up on that blog to see if the author can provide you more things.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 15, 2015 7:30 AM
    Moderator