FreeCalypso > hg > freecalypso-hwlab
diff simtool/grcard1.c @ 153:a63e4c64f1f0
fc-simtool: grcard1-set-ki command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 07 Feb 2021 00:46:18 +0000 |
parents | 451ed3bbfe96 |
children |
line wrap: on
line diff
--- a/simtool/grcard1.c Sun Feb 07 00:23:06 2021 +0000 +++ b/simtool/grcard1.c Sun Feb 07 00:46:18 2021 +0000 @@ -90,3 +90,28 @@ } return(0); } + +cmd_grcard1_set_ki(argc, argv) + char **argv; +{ + u_char cmd[21]; + int rc; + + /* Grcard1 proprietary command APDU */ + cmd[0] = 0x80; + cmd[1] = 0xD4; + cmd[2] = 0x02; + cmd[3] = 0x00; + cmd[4] = 16; + rc = decode_hex_data_from_string(argv[1], cmd + 5, 16, 16); + if (rc < 0) + return(rc); + rc = apdu_exchange(cmd, 21); + if (rc < 0) + return(rc); + if (sim_resp_sw != 0x9000) { + fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw); + return(-1); + } + return(0); +}