Le 08/07/2011 21:46, Pace Willisson a écrit : > Hi. I'm working on finishing the driver for the acos5 card. With > some luck, I'll have some code worth testing in the next few weeks. > I'm working out of a github fork at https://github.com/pacew/OpenSC > > My current puzzle is that the acos5 stores public and private keys in > separate files, but part of the data within each file is the 16 bit > file id of the other half of the pair. zI guess I need to somehow > pre-allocate the file ids and pass them down from do_store_private_key > in pkcs15-init.c, though perhaps there is a better way. Is there > another card that faces this issue that would be a good example to > study? I'd appreciate any guidance.
I don't know acos card and driver, but, I don't think that you need to define the key's file-id at the application level. Normally the file-id spaces for the private and public keys are separated by the card profile -- they have different first byte of file-id. When storing private key, the common pkcs15init procedures call certain number of the card specific handlers, where you can control/set/change some of the parameters, including the file-id of the file to create. Such handlers are 'select_key_reference', 'create_key' or 'store_key'. In these card specific handlers you can realize the rule that the connected public and private key files have the same second byte of the file-id and the first one is defined by the profile. Something like: when importing private/public key, look for the pkcs#15 object of its public/private friend (they have the same ID in term of PKCS#15), and if exists, take it's file-id and derive the public/private key file-id (change the first byte according to the card profile). > And, more generally, which driver(s) would be best to look at for good > implementation examples? > > Thanks, > Pace Willisson > p...@alum.mit.edu Kind regards, Viktor. > _______________________________________________ > opensc-devel mailing list > opensc-devel@lists.opensc-project.org > http://www.opensc-project.org/mailman/listinfo/opensc-devel > _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel