PKCS15 - OpenPGP: Change way to check certificate object.
Old: If cert is missing, raise error. New: If cert have data, declare object, otherwise, just ignore it.
This commit is contained in:
parent
5e295ba08d
commit
735883d8f6
|
@ -158,6 +158,8 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
|||
const pgp_pin_cfg_t *pin_cfg = (card->type == SC_CARD_TYPE_OPENPGP_V2) ? pin_cfg_v2 : pin_cfg_v1;
|
||||
struct sc_pkcs15_cert_info cert_info;
|
||||
struct sc_pkcs15_object cert_obj;
|
||||
sc_path_t path;
|
||||
sc_file_t *file;
|
||||
|
||||
memset(&cert_info, 0, sizeof(cert_info));
|
||||
memset(&cert_obj, 0, sizeof(cert_obj));
|
||||
|
@ -333,6 +335,17 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
|||
}
|
||||
}
|
||||
|
||||
/* Check if 7F21 DO holds data */
|
||||
sc_format_path("7F21", &path);
|
||||
r = sc_select_file(card, &path, &file);
|
||||
if (r < 0)
|
||||
goto failed;
|
||||
|
||||
/* If 7F21 DO holds no data, we do nothing */
|
||||
if (file->size == 0)
|
||||
return SC_SUCCESS;
|
||||
/* else, we declare cert object for pkcs15 */
|
||||
|
||||
/* Certificate ID. We use the same ID as the authentication key */
|
||||
cert_info.id.value[0] = 3;
|
||||
cert_info.id.len = 1;
|
||||
|
|
Loading…
Reference in New Issue