-
Notifications
You must be signed in to change notification settings - Fork 803
Support for IDPrime MD 830, 930 and 940 cards #2666
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
Conversation
|
Added reading of cmap file, which contains records holding private key container names and index of corresponding certificates. It is used for the detection of CA certificates on the card. For IDPrime 940, there is also a second PIN (Digital Signature PIN) used for accessing CC certificates on the card. File |
51b87d4 to
84642ac
Compare
`kxc` and `ksc` objects denote certificates. Certificate objects can be standalone - then we expect that they have public and private keys on the card, or there can be `priprk` and `pubksc` denoting corresponding private a public keys.
Cmap file contains records denoting container name and the record index corresponds to the index of certificate.
IDPrime 940 uses digital signature pin for accessing CC certificates
File 0x0005 on IDPrime 940 contains 8 bytes records, which probably denote key reference and PIN index associated with certificate index.
Jakuje
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully last comments
frankmorgner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please look at @Jakuje comment about the possible memory leak, thank you.
To indicate that the returned memory does not need to be free'd.
|
Thank you! |
Driver
card-idprime.cdoes not support some of the IDPrime cards - MD 830, 930 and 940.The main problem is not matching key references that are assigned during the processing of the index file. The key references were recently set according to the OS version. However, some of the tested cards shared the same OS version but different key references of the private keys. The card matching is now done via ATR for particular card types, and the key reference offsets are distinguished according to
card->type.The
idprime_process_index()function for processing the0x0101file adds the found certificate objects to the card. The index file contains entries which (probably) differ as the certificates were imported to the card with different tools. The entries can bekscorkxcalone - card should have corresponding private and public keyksc/kxcwithpubkxs/pubkxc- certificate is missing corresponding private key (CA certificates)priprk,ksc/kxcandpubkxs/pubkxc- card should have the corresponding private and public keyEach certificate entry contains an index and the offset used for getting the private key reference.
Certificates that are missing a private key on the card are also added to the card but with some dummy key reference, which is then processed in
sc_pkcs15emu_idprime_init(), where only the public key is added.IDPrime 930 and 940 cards can work with 4096b RSA keys, which is added to the card initialization.
Cards also support EC keys and certificates - the
sc_pkcs15emu_idprime_init()is extended by adding EC keys to the card. When signing with ECDSA keys, the data for signature needs to be padded (probably to some multiple of 8 bytes) before sending to the card.The changes were tested with cards
There are still some issues which need to be addressed
idprime_process_index()) of EC keys may differ from the key references of RSA key