Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for D-Trust Card 5.1 & 5.4 #3137

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Next Next commit
dtrust: Read serial number from EF.GDO
This is necessary, because for D-Trust Cards 5.x the CardOS command
requires PACE authentication.
  • Loading branch information
hamarituc committed Jun 3, 2024
commit 440c787ba675b891a5e1de9c3afc080fe9a0dbab
16 changes: 5 additions & 11 deletions src/libopensc/card-dtrust.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,14 @@ static int
_dtrust_get_serialnr(sc_card_t *card)
{
int r;
u8 buf[32];

r = sc_get_data(card, 0x0181, buf, 32);
LOG_TEST_RET(card->ctx, r, "querying serial number failed");

if (r != 8) {
sc_log(card->ctx, "unexpected response to GET DATA serial number");
return SC_ERROR_INTERNAL;
card->serialnr.len = SC_MAX_SERIALNR;
r = sc_parse_ef_gdo(card, card->serialnr.value, &card->serialnr.len, NULL, 0);
if (r < 0) {
card->serialnr.len = 0;
return r;
}

/* cache serial number */
memcpy(card->serialnr.value, buf, 8);
card->serialnr.len = 8;

return SC_SUCCESS;
}

Expand Down