From fc311c40ff258f102e79f3893a54ed1b0e42a842 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Sun, 24 Apr 2022 00:24:25 +0200 Subject: [PATCH] Updated key info to report generated keys in the card. Signed-off-by: Pol Henarejos --- src/openpgp/openpgp.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/openpgp/openpgp.c b/src/openpgp/openpgp.c index 638bdcc..f7d63a5 100644 --- a/src/openpgp/openpgp.c +++ b/src/openpgp/openpgp.c @@ -344,14 +344,26 @@ int parse_keyinfo(const file_t *f, int mode) { res_APDU[res_APDU_size++] = EF_KEY_INFO & 0xff; res_APDU[res_APDU_size++] = 6; } + file_t *ef = search_by_fid(EF_PK_SIG, NULL, SPECIFY_ANY); res_APDU[res_APDU_size++] = 0x00; - res_APDU[res_APDU_size++] = 0x00; + if (ef && ef->data) + res_APDU[res_APDU_size++] = 0x01; + else + res_APDU[res_APDU_size++] = 0x00; + ef = search_by_fid(EF_PK_DEC, NULL, SPECIFY_ANY); res_APDU[res_APDU_size++] = 0x01; - res_APDU[res_APDU_size++] = 0x00; + if (ef && ef->data) + res_APDU[res_APDU_size++] = 0x01; + else + res_APDU[res_APDU_size++] = 0x00; + ef = search_by_fid(EF_PK_AUT, NULL, SPECIFY_ANY); res_APDU[res_APDU_size++] = 0x02; - res_APDU[res_APDU_size++] = 0x00; + if (ef && ef->data) + res_APDU[res_APDU_size++] = 0x01; + else + res_APDU[res_APDU_size++] = 0x00; return res_APDU_size-init_len; }