Chaskiel Grundman:

Nowhere in pkcs15init/pkcs15-cardos.c is the user pin ever 
requested or presented to the card. 
Since the update acl for the key object uses the user pin, the GENERATE 
KEY operation fails when it isn't logged in.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3537 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aj 2008-07-21 14:35:21 +00:00
parent 2599fa795d
commit 64fd479aa5
1 changed files with 8 additions and 1 deletions

View File

@ -308,7 +308,8 @@ cardos_generate_key(sc_profile_t *profile, sc_card_t *card,
u8 abignum[256];
int algorithm, r, delete_it = 0, use_ext_rsa = 0;
size_t keybits, rsa_max_size;
int pin_id = -1;
if (obj->type != SC_PKCS15_TYPE_PRKEY_RSA)
return SC_ERROR_NOT_SUPPORTED;
@ -334,6 +335,12 @@ cardos_generate_key(sc_profile_t *profile, sc_card_t *card,
"for key generation.");
return SC_ERROR_NOT_SUPPORTED;
}
pin_id = sc_keycache_find_named_pin(&key_info->path, SC_PKCS15INIT_USER_PIN);
if (pin_id > 0) {
r = sc_pkcs15init_verify_key(profile, card, NULL, SC_AC_CHV, pin_id);
if (r < 0)
return r;
}
if (use_ext_rsa == 0)
temp->ef_structure = SC_FILE_EF_LINEAR_VARIABLE_TLV;
else