ykneo-openpgp icon indicating copy to clipboard operation
ykneo-openpgp copied to clipboard

opensc compatibility

Open klali opened this issue 11 years ago • 9 comments

The openpgp applet today is not compatible with opensc, it would probably be a good idea to be compatible even if opensc requires the atr to be listed to recognize the card.

klali avatar Apr 19 '13 08:04 klali

+1

Yannovitch avatar Apr 04 '14 22:04 Yannovitch

:+1:

oliverklee avatar Apr 05 '14 11:04 oliverklee

+1

Doridian avatar Jun 13 '14 19:06 Doridian

So what's involved in making this happen? Is it about patching OpenSC, or is something required in the applet?

jas4711 avatar Aug 04 '14 18:08 jas4711

It's probably only changes to the applet to conform to expectations of OpenSC.

As the openpgp driver in OpenSC does it's detection based on ATR the driver choice has to be forced instead of autodetected. The first and simplest test is to run:

$ OPENSC_DEBUG=9 opensc-tool -c openpgp -n

and compare with a standard openpgp card.

klali avatar Aug 05 '14 06:08 klali

It seems that OpenSC sends SELECT-FILE:

00 A4 04 00 06 D2 76 00 01 24 01 00

The OpenPGP card returns

62 15 84 10 D2 76 00 01 24 01 02 00 00 05 00 00
21 E4 00 00 8A 01 05 90 00

but Yubico only returns

90 00

The OpenPGP spec 2.0 allows to return a FCI or empty (p. 31) but OpenSC bails out expecting either an FCI or FCP response.

asheiduk avatar Nov 23 '14 10:11 asheiduk

The OpenPGP spec 2.0 allows to return a FCI or empty (p. 31) but OpenSC bails out expecting either an FCI or FCP response.

Sounds like OpenSC is not following the spec? In this case we should patch OpenSC instead of the applet?

stv0g avatar Aug 06 '15 16:08 stv0g

What's the SELECT FILE command supposed to do? If we can make OpenSC accept this (supposedly legal?) output, would it make the OpenSC OpenPGP PKCS#11 driver work? That would be good -- I just read http://changelog.complete.org/archives/9381-detailed-smart-card-cryptographic-token-security-guide and it suggested the neo didn't work with opensc in openpgp mode.

jas4711 avatar Aug 07 '15 14:08 jas4711

Just stumbled across this; a bug report would have been nice...

Anyway, it's fixed in OpenSC with https://github.com/OpenSC/OpenSC/pull/1232

frankmorgner avatar Jan 22 '18 14:01 frankmorgner