Giter Club home page Giter Club logo

libiso7816's People

Contributors

arnauldm avatar pthierry avatar pthierry38 avatar rben-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

libiso7816's Issues

T1 and extended length command failure

Hi, I've been using libiso7816 with my smartcard application at T=1 configuration. Short commands (<255 byte length) seem to work well, but as soon as an extended length command is sent, errors are shown:

SC_fsm_early_init(SC_MAP_AUTO);
SC_fsm_init(&card, 0 /* do_negotiate_pts */, 0 /* do_change_baudrate */, 2 /* do_force_protocol T=1 */, 0 /* do_force_etu */);

apdu.cla = 0x00; apdu.ins = requestType; apdu.p1 = apdu.p2 = 0x00;
apdu.le = 0xFF; apdu.send_le = 1;
SC_send_APDU(&apdu, &res, &card);

This is using the default init (though with T=1 forced as it is a T=1 card), and with a smartcard applet that is known to work with extended length commands in other programs.

Returns the following error:

[Smartcard T=1] Unexpected case: received other block than expected IBLOCK, or bad sequence number ...

and seems to fail here: https://github.com/wookey-project/libiso7816/blob/master/smartcard_iso7816.c#L1952

I can see that a RBLOCK is received at that point while the last block (out of 2 blocks) is being sent and therefore an IBLOCK is expected.

Not sure whats going on, but this seems to be a bug in the handling logic?

About WT calculate with TC2

In libiso7816, calculate wi = atr->tc[1] & 0x0f, but in SPEC 7816 it says TC2 encodes the waiting time integer WI over the eight bits, except the value '00' reserved for future use.
So should it be if (atr->tc[1] != 0) wi = atr->tc[1] ?
And another question, in SC_push_pull_APDU_T0( ) comments we send a 0 as P3 in a case 1 APDU, but code is send le byte, it could be a mistake?

Case 2S.3 and T0 BGT

Hi, I didn't find lib process "Case 2S.3 -- Process aborted; Ne not accepted, Na indicated", it mapped 6C XX to the Response APDU directly. I think lib should add hadling of this case.
Another question, I find some T0 card (some credit card, like PBOC, EMV card), can not work well if I do not add delay (here I used 16etus), between the leading edages of the start bits of the last character received and the first character sent in the opposite direction. Although I find this principle in EMV book1 SPEC( EMV 4.2 book1 9.2.2.1 For the ICC or terminal, the minimum interval between the leading edges of thestart bits of the last character received and the first character sent in theopposite direction shall be 16 etus.), but I did not find in ISO7816 SPEC.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.