|
Lines 135-141
Link Here
|
| 135 |
&pin_obj); |
135 |
&pin_obj); |
| 136 |
if (r == SC_ERROR_OBJECT_NOT_FOUND) { |
136 |
if (r == SC_ERROR_OBJECT_NOT_FOUND) { |
| 137 |
/* no pin required */ |
137 |
/* no pin required */ |
| 138 |
sc_lock(card); |
138 |
r = sc_lock(card); |
|
|
139 |
if (r) { |
| 140 |
error("Unable to lock smartcard: %s", sc_strerror(r)); |
| 141 |
goto err; |
| 142 |
} |
| 139 |
*key_obj_out = key_obj; |
143 |
*key_obj_out = key_obj; |
| 140 |
return 0; |
144 |
return 0; |
| 141 |
} else if (r) { |
145 |
} else if (r) { |
|
Lines 429-437
Link Here
|
| 429 |
} |
433 |
} |
| 430 |
key_count = r; |
434 |
key_count = r; |
| 431 |
} |
435 |
} |
| 432 |
/* FIXME: only keep entries with a corresponding private key */ |
|
|
| 433 |
keys = xmalloc(sizeof(Key *) * (key_count*2+1)); |
436 |
keys = xmalloc(sizeof(Key *) * (key_count*2+1)); |
| 434 |
for (i = 0; i < key_count; i++) { |
437 |
for (i = 0; i < key_count; i++) { |
|
|
438 |
sc_pkcs15_object_t *tmp_obj = NULL; |
| 439 |
cert_id = ((sc_pkcs15_cert_info_t *)(certs[i]->data))->id; |
| 440 |
if (sc_pkcs15_find_prkey_by_id(p15card, &cert_id, &tmp_obj)) |
| 441 |
/* skip the public key (certificate) if no |
| 442 |
* corresponding private key is present */ |
| 443 |
continue; |
| 435 |
k = key_new(KEY_RSA); |
444 |
k = key_new(KEY_RSA); |
| 436 |
if (k == NULL) |
445 |
if (k == NULL) |
| 437 |
break; |
446 |
break; |