-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: support for Belgian eID cards #104
base: master
Are you sure you want to change the base?
Commits on Jun 15, 2017
-
Start work on adding a belpic implementation
BELPIC (BELgian Personal Identity Card) is the official electronic ID card of Belgium. Start adding a virtual implementation of this card to vsmartcard. Not remotely there yet, but at least this runs without error already, and sends the correct ATR when asked. Beyond that... much TODO.
Configuration menu - View commit details
-
Copy full SHA for 99ff2a4 - Browse repository at this point
Copy the full SHA 99ff2a4View commit details -
Do not allow creation of files
The BeID card does not allow the user to create extra files, so disallow when it is tried
Configuration menu - View commit details
-
Copy full SHA for 793a305 - Browse repository at this point
Copy the full SHA 793a305View commit details -
Upon initialisation, read the XML file
Current BeID development tools work with XML files to represent the data on the card. Reuse that format, so that existing developers don't have to regenerate their cards (and so that a certain level of interoperability between those tools exists) We may add another option in the future, but that's not for now. Also, add the Belpic applet's AID as the DF name for the MF
Configuration menu - View commit details
-
Copy full SHA for 5c6c522 - Browse repository at this point
Copy the full SHA 5c6c522View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8e6266a - Browse repository at this point
Copy the full SHA 8e6266aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0751076 - Browse repository at this point
Copy the full SHA 0751076View commit details -
Generated by <https://github.com/Fedict/eid-test-cards/tree/master/gen_virtual_cards>. TODO: generate it here, rather than there. Not for now.
Configuration menu - View commit details
-
Copy full SHA for 6bba615 - Browse repository at this point
Copy the full SHA 6bba615View commit details -
(and trigger a travis build while we're at it) Signed-off-by: Wouter Verhelst <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for cdbe8fc - Browse repository at this point
Copy the full SHA cdbe8fcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9dc0f73 - Browse repository at this point
Copy the full SHA 9dc0f73View commit details -
Make the Relay card still parse and log the APDU
The basic VirtualSmartcard implementation parses and logs the APDU sent to the card in the execute instance method, and logs the received APDU after calling that method. The Relay implementation, however, overrides the execute method, but does not log it. The result, when running at the info log level, is that you see the reply from the card, but not the request from the application. This is confusing. Additionally, if the relay implementation shows the request APDU, then it can be used as a method to analyze what an application is trying to do. To remedy all that, parse the APDU and log that parsed value, but don't do anything further with it. Signed-off-by: Wouter Verhelst <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a8ca1d3 - Browse repository at this point
Copy the full SHA a8ca1d3View commit details -
Some unknown cards, which the Relay card may need to deal with, may not use the APDU format. Trying to parse commands sent to those cards as though they were in the APDU format is obviously wrong. However, most cards do support APDU, so default to logging parsed APDUs, still.
Configuration menu - View commit details
-
Copy full SHA for e3a1aac - Browse repository at this point
Copy the full SHA e3a1aacView commit details -
Only respond to the commands that this card actually implements
Also, implement a stub version of the "GET CARD DATA" and "LOG OFF" commands that are proprietary to the Belpic applet.
Configuration menu - View commit details
-
Copy full SHA for efb57b0 - Browse repository at this point
Copy the full SHA efb57b0View commit details -
Configuration menu - View commit details
-
Copy full SHA for ddc0df1 - Browse repository at this point
Copy the full SHA ddc0df1View commit details -
Now that we have a correct ins2handler dict, drop the unneeded create method
Configuration menu - View commit details
-
Copy full SHA for a53b172 - Browse repository at this point
Copy the full SHA a53b172View commit details -
Configuration menu - View commit details
-
Copy full SHA for fb7ec85 - Browse repository at this point
Copy the full SHA fb7ec85View commit details -
Filter the SELECT FILE command
The spec for the Belgian electronic ID card interprets the ISO 7816 "SELECT FILE" command in a somewhat simplified way. First, the MF (3F00) can be selected from anywhere when P1 = 0x02; second, child DFs are selected also with P1 = 0x02. The applet does not interpret or treat specially cases where P1 = 0x00 or P1 = 0x01. In order to not to have to rewrite the "select file" logic that already exists in the Iso7816OS class, filter those two commands so that they contain the P1 value which the Iso7816OS class would search for.
Configuration menu - View commit details
-
Copy full SHA for 5fc6018 - Browse repository at this point
Copy the full SHA 5fc6018View commit details -
The belpic applet does not deal with file sizes. It just returns less data than was requested, and the remote is supposed to figure out that the file was smaller than it assumed before based on that. It still returns SW12 0x9000 in that case, however. Add a "formatResult" method which filters out the SW12 = 0x6282 case, so that applications don't see values they don't expect.
Configuration menu - View commit details
-
Copy full SHA for 5eb000d - Browse repository at this point
Copy the full SHA 5eb000dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 03a1136 - Browse repository at this point
Copy the full SHA 03a1136View commit details
Commits on Jun 20, 2017
-
Make sure these files actually have some content
Otherwise the file is unavailable and the eid-mw PKCS#11 module complains that the card is broken.
Configuration menu - View commit details
-
Copy full SHA for 75f5b49 - Browse repository at this point
Copy the full SHA 75f5b49View commit details -
Configuration menu - View commit details
-
Copy full SHA for e65e13a - Browse repository at this point
Copy the full SHA e65e13aView commit details