{"action":"created","issue":{"url":"https://api.github.com/repos/OpenSC/engine_pkcs11/issues/31","labels_url":"https://api.github.com/repos/OpenSC/engine_pkcs11/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/OpenSC/engine_pkcs11/issues/31/comments","events_url":"https://api.github.com/repos/OpenSC/engine_pkcs11/issues/31/events","html_url":"https://github.com/OpenSC/engine_pkcs11/issues/31","id":123435498,"number":31,"title":"engine_pkcs11 enumerates only private keys","user":{"login":"mouse07410","id":5923577,"avatar_url":"https://avatars.githubusercontent.com/u/5923577?v=3","gravatar_id":"","url":"https://api.github.com/users/mouse07410","html_url":"https://github.com/mouse07410","followers_url":"https://api.github.com/users/mouse07410/followers","following_url":"https://api.github.com/users/mouse07410/following{/other_user}","gists_url":"https://api.github.com/users/mouse07410/gists{/gist_id}","starred_url":"https://api.github.com/users/mouse07410/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mouse07410/subscriptions","organizations_url":"https://api.github.com/users/mouse07410/orgs","repos_url":"https://api.github.com/users/mouse07410/repos","events_url":"https://api.github.com/users/mouse07410/events{/privacy}","received_events_url":"https://api.github.com/users/mouse07410/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-12-22T08:04:54Z","updated_at":"2015-12-29T22:08:37Z","closed_at":null,"body":"File `src/engine_pkcs11.c`, around line 989:\r\n```\r\n\t/* Make sure there is at least one private key on the token */\r\n\tif (PKCS11_enumerate_keys(tok, &keys, &key_count)) {\r\n\t\tfail(\"unable to enumerate keys\\n\");\r\n\t}\r\n\tif (key_count == 0) {\r\n\t\tfail(\"No keys found.\\n\");\r\n\t}\r\n\r\n\tif (verbose) {\r\n\t\tfprintf(stderr, \"Found %u key%s:\\n\", key_count,\r\n\t\t\t(key_count <= 1) ? \"\" : \"s\");\r\n\t}\r\n```\r\n\r\nCall to `PKCS11_enumerate_keys()` returns only the private keys. I think it should include public keys as well. \r\n\r\nIf this function/method is unable to do so, what are the alternatives?"},"comment":{"url":"https://api.github.com/repos/OpenSC/engine_pkcs11/issues/comments/167888143","html_url":"https://github.com/OpenSC/engine_pkcs11/issues/31#issuecomment-167888143","issue_url":"https://api.github.com/repos/OpenSC/engine_pkcs11/issues/31","id":167888143,"user":{"login":"mouse07410","id":5923577,"avatar_url":"https://avatars.githubusercontent.com/u/5923577?v=3","gravatar_id":"","url":"https://api.github.com/users/mouse07410","html_url":"https://github.com/mouse07410","followers_url":"https://api.github.com/users/mouse07410/followers","following_url":"https://api.github.com/users/mouse07410/following{/other_user}","gists_url":"https://api.github.com/users/mouse07410/gists{/gist_id}","starred_url":"https://api.github.com/users/mouse07410/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mouse07410/subscriptions","organizations_url":"https://api.github.com/users/mouse07410/orgs","repos_url":"https://api.github.com/users/mouse07410/repos","events_url":"https://api.github.com/users/mouse07410/events{/privacy}","received_events_url":"https://api.github.com/users/mouse07410/received_events","type":"User","site_admin":false},"created_at":"2015-12-29T22:08:37Z","updated_at":"2015-12-29T22:08:37Z","body":"Here's the code of `pkcs11_get_ec_public()`, as it was a dummy routine calling `pkcs11_get_ec_private()` before:\r\n```\r\n\t      if (verbose)\r\n\t\tEC_KEY_print_fp(stderr, ec, 5);\r\n\t    }\r\n\t  }\r\n\t}\r\n\r\n\tif (os)\r\n\t    M_ASN1_OCTET_STRING_free(os);\r\n\tif (ec_point)\r\n\t\tOPENSSL_free(ec_point);\r\n\tif (ec_params)\r\n\t\tOPENSSL_free(ec_params);\r\n\r\n\tif (sensitive || !extractable) {\r\n\t\tECDSA_set_ex_data(ec, 0, key);\r\n\t\tEC_KEY_free(ec); /* drops our reference to it. */\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tif (ec)\r\n\t    EC_KEY_free(ec);\r\n\treturn -1;\r\n\t\r\n}\r\n```"}}