FreeCalypso > hg > freecalypso-hwlab
comparison 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 |
comparison
equal
deleted
inserted
replaced
152:250d172662ca | 153:a63e4c64f1f0 |
---|---|
88 fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw); | 88 fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw); |
89 return(-1); | 89 return(-1); |
90 } | 90 } |
91 return(0); | 91 return(0); |
92 } | 92 } |
93 | |
94 cmd_grcard1_set_ki(argc, argv) | |
95 char **argv; | |
96 { | |
97 u_char cmd[21]; | |
98 int rc; | |
99 | |
100 /* Grcard1 proprietary command APDU */ | |
101 cmd[0] = 0x80; | |
102 cmd[1] = 0xD4; | |
103 cmd[2] = 0x02; | |
104 cmd[3] = 0x00; | |
105 cmd[4] = 16; | |
106 rc = decode_hex_data_from_string(argv[1], cmd + 5, 16, 16); | |
107 if (rc < 0) | |
108 return(rc); | |
109 rc = apdu_exchange(cmd, 21); | |
110 if (rc < 0) | |
111 return(rc); | |
112 if (sim_resp_sw != 0x9000) { | |
113 fprintf(stderr, "bad SW response: %04X\n", sim_resp_sw); | |
114 return(-1); | |
115 } | |
116 return(0); | |
117 } |