FreeCalypso > hg > fc-pcsc-tools
changeset 47:ae3342497fea
fc-simtool verify-hex command added
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 13 Feb 2021 00:57:57 +0000 |
parents | 32d6186668cf |
children | 9a21f4353158 |
files | simtool/chvext.c simtool/dispatch.c |
diffstat | 2 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/simtool/chvext.c Sat Feb 13 00:01:38 2021 +0000 +++ b/simtool/chvext.c Sat Feb 13 00:57:57 2021 +0000 @@ -31,3 +31,28 @@ } return(0); } + +cmd_verify_hex(argc, argv) + char **argv; +{ + u_char cmd[13]; + int rc; + + /* VERIFY CHV command APDU */ + cmd[0] = 0xA0; + cmd[1] = 0x20; + cmd[2] = 0x00; + cmd[3] = strtoul(argv[1], 0, 0); + cmd[4] = 8; + rc = decode_hex_data_from_string(argv[2], cmd + 5, 8, 8); + if (rc < 0) + return(rc); + rc = apdu_exchange(cmd, 13); + if (rc < 0) + return(rc); + if (sim_resp_sw != 0x9000) { + fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw); + return(-1); + } + return(0); +}
--- a/simtool/dispatch.c Sat Feb 13 00:01:38 2021 +0000 +++ b/simtool/dispatch.c Sat Feb 13 00:57:57 2021 +0000 @@ -57,6 +57,7 @@ extern int cmd_update_rec(); extern int cmd_verify_chv(); extern int cmd_verify_ext(); +extern int cmd_verify_hex(); extern int display_sim_resp_in_hex(); extern int good_exit(); @@ -134,6 +135,7 @@ {"verify-chv1", 1, 1, cmd_verify_chv}, {"verify-chv2", 1, 1, cmd_verify_chv}, {"verify-ext", 2, 2, cmd_verify_ext}, + {"verify-hex", 2, 2, cmd_verify_hex}, {"verify-pin1", 1, 1, cmd_verify_chv}, {"verify-pin2", 1, 1, cmd_verify_chv}, {0, 0, 0, 0}