Hello, On a developing of an external smart card driver, there is the necessity of verifying the PIN before reading any public key.
This makes that I get an error for each public key whenever I try to list all PKCS#11 objects on card. I think it could be usefull check whether the flag SC_PKCS15_CO_FLAG_PRIVATE is set on a public key (the same way as on certificate objects), reading only if this flag is not present and returning NULL otherwise. I attach a patch on a solution that works for me. I would be glad if you could aply this patch on OpenSC code. Thanks very much, -- Albert Solana Berengué [EMAIL PROTECTED] C3PO, S.L. http://www.c3po.es C/Bertran, 113 - 08023 Barcelona Tel. 93 417 99 55 - Fax. 93 253 12 80
Index: src/pkcs11/framework-pkcs15.c =================================================================== --- src/pkcs11/framework-pkcs15.c (revision 2877) +++ src/pkcs11/framework-pkcs15.c (working copy) @@ -325,8 +325,12 @@ * During initialization process, the key may have been created * and saved as a file before the certificate has been created. */ - if ((rv = sc_pkcs15_read_pubkey(fw_data->p15_card, pubkey, &p15_key)) < 0) - p15_key = NULL; + if (pubkey->flags & SC_PKCS15_CO_FLAG_PRIVATE) /* is the key private? */ + p15_key = NULL; /* will read key when needed */ + else { + if ((rv = sc_pkcs15_read_pubkey(fw_data->p15_card, pubkey, &p15_key)) < 0) + p15_key = NULL; + } /* Public key object */ rv = __pkcs15_create_object(fw_data, (struct pkcs15_any_object **) &object,
_______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel