santigimeno/node-pcsclite

OSX SCardTransmit error

Opened this issue · 6 comments

Hi,
I'm just starting to learn smartcards systems and run into a problem. I have an HID Omikey 5321 CR on OSX El capitan. I installed the drivers from HID for osx. and try to run the exemple code from the node node-pcsclite.
The reader is recognized, and I can read the atr :

card inserted
Protocol( OMNIKEY CardMan (076B:5320) 5321 ): 2
Status( OMNIKEY CardMan (076B:5320) 5321 ): { state: 290,
atr: <Buffer 3b 8f 80 01 80 4f 0c a0 00 00 03 06 03 00 01 00 00 00 00 6a> }

but when it comes to send an APDU it keeps returning me

 [Error: SCardTransmit error: Transaction failed.(0x80100016)]

From the HID device documentation :

Reading all 15 blocks from 0 to 14
Command APDU: ‘FFB0000000’
Response APDE: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx9000’
Attempt to read 16 blocks
Command APDU: ‘FFB0000010’
Response APDE: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6282’

so I use

reader.transmit(new Buffer([0xFF, 0xB0, 0x00,0x00, 0x00]), 255, protocol, function(err, data) {
... }

But still the same error.

There is surely some steps i missed, so can anyone Help me ?

Thanks in advance

@kevinfiraguay what kind of card are you inserting in the reader?

@kevinfiraguay there's usually some sample code in the driver package. Have you tried it? Does it work for you?

Hi, sorry for this late answer and thank you for your reactivity.
The card type is a Mifare classic.
There's no exemple code with the drivers but we do have a java program that works with the card reader and the same card.
It only stop working when i try to send APDU command.

@kevinfiraguay your Java program stops working when you try to send APDU commands? I am not sure what you are referring by "It".

You should first try with a simple C program to check your card + reader + driver + PC/SC is working.
See http://ludovicrousseau.blogspot.fr/2010/04/pcsc-sample-in-c.html

You can also check the same C or javascript program on GNU/Linux to check it is not a Mac OS X bug.
See http://ludovicrousseau.blogspot.fr/2015/11/os-x-el-capitan-and-smart-cards-known.html

I'm sorry, my message was not very clear. By "it" I meant my nodejs code.
The Java code works. Thank you for your answers, i'm going to try both your advices and tell you how it worked.
Thanks again

hi kevinfiraguay , did you find solution to your problem? please share here