Skip to content

Commit

Permalink
sc-hsm-tool: check for expected tags (.pka files)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Braun committed Jun 20, 2019
1 parent 48ef02c commit 5750d63
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tools/sc-hsm-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,11 @@ static int register_public_key(sc_context_t *ctx, sc_card_t *card, const char *i
r = -1;
goto err;
}
if (tag_out != 0x7) {
fprintf(stderr, "Wrong tag when reading public key: got %x, expected %x\n", tag_out, 0x7);
r = -1;
goto err;
}
pk = buf;
pk_len = taglen;
buf += taglen;
Expand All @@ -1953,6 +1958,11 @@ static int register_public_key(sc_context_t *ctx, sc_card_t *card, const char *i
r = -1;
goto err;
}
if (tag_out != 0x1f21) {
fprintf(stderr, "Wrong tag when reading device certificate: got %x, expected %x\n", tag_out, 0x1f21);
r = -1;
goto err;
}
devcert = buf;
devcert_len = taglen;
buf += taglen;
Expand All @@ -1963,6 +1973,11 @@ static int register_public_key(sc_context_t *ctx, sc_card_t *card, const char *i
r = -1;
goto err;
}
if (tag_out != 0x1f21) {
fprintf(stderr, "Wrong tag when reading device CA: got %x, expected %x\n", tag_out, 0x1f21);
r = -1;
goto err;
}
dicacert = buf;
dicacert_len = taglen;

Expand Down

0 comments on commit 5750d63

Please sign in to comment.