Hello Nguyễn, Le 07/05/2012 10:42, Nguyễn Hồng Quân a écrit : > I've updated the openpgp-card.c and the select_file() now returns right > error "Data object not found". > However, in the final list, the missing pub key still be listed (see the > attached log). > > Is anything wrong with the PKCS15 common part?
This card is not natively PKCS#15 card, and emulator is used to expose the pkcs#15 objects. If you definitively need to deal with the non-initialized card, imho, you have to review it's emulator part (libopensc/pkcs15-openpgp.c) . > Thanks, Kind regards, Viktor. > On 05/05/2012 07:29 PM, Viktor Tarasov wrote: >> Le 05/05/2012 07:14, Nguyễn Hồng Quân a écrit : >>> Thanks Viktor, >>> >>> I found the defect at the function pgp_get_blob() in card-openpgp.c. >>> There are lines: >>> >>> if (child->id == id) { >>> (void) pgp_read_blob(card, child); >>> *ret = child; >>> return SC_SUCCESS; >>> >>> The problem is either: >>> 1. The child blob does not exist, but there still exists its ID. >>> 2. The result of pgp_read_blob(card, child) is not checked. >>> >>> This function is called by file_select and because it returns SUCCESS, >>> it makes file_select SUCCESS although the blob does not exist. >>> >>> I think fixing 1 is better. What do you think? (Or the ID is >>> pre-defined?) >>> >>> I'm new (and this driver was not written by me), so I'm grateful to >>> receive your guidance. >> First of all, >> I do not know openpgp card and do not have this card to make the tests. >> >> Afaiu, the 'child' and it's 'ID' are the openpgp specific features that do >> not have any relation to the 7816 standards. >> They has to be hidden from the common OpenSC library part by the openpgp >> card's driver. >> >> The authors of openpgp driver could explain better, >> by from my point of view, >> if the blob cannot be read, pgp_select() has to return 'file-not-found' or >> other error. >> In any case with such openpgp internal errors there is no possibility to >> return a valid FCP/FCI and valid file length. >> >> Looking onto the code I suppose that the FCP returned by >> pgp_select(public-key) belongs in fact to MF (or intermediate DF). >> That's for, in my previous mail, I asked you >> what are the 'type' and 'ef-structure' of the sc_file data returned by >> 'successful' pgp_select() ? >> _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel