FreeCalypso > hg > fc-sim-tools
view simtool/stktest.c @ 86:de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 11 Apr 2021 03:19:22 +0000 |
parents | ddd767f6e15b |
children | 3d9c50880ae7 |
line wrap: on
line source
/* * This module implements some commands for testing SIM Toolkit functionality, * just enough to be able to simulate SMS-PP SIM data download operations. */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include "simresp.h" cmd_terminal_profile(argc, argv) char **argv; { u_char cmd[260]; int rc; unsigned len; rc = decode_hex_data_from_string(argv[1], cmd + 5, 1, 255); if (rc < 0) return(rc); len = rc; /* TERMINAL PROFILE command APDU */ cmd[0] = 0xA0; cmd[1] = 0x10; cmd[2] = 0; cmd[3] = 0; cmd[4] = len; rc = apdu_exchange(cmd, len + 5); if (rc < 0) return(rc); printf("%04X\n", sim_resp_sw); return(0); } cmd_envelope(argc, argv) char **argv; { u_char cmd[260]; int rc; unsigned len; rc = read_hex_data_file(argv[1], cmd + 5, 255); if (rc < 0) return(rc); len = rc; /* ENVELOPE command APDU */ cmd[0] = 0xA0; cmd[1] = 0xC2; cmd[2] = 0; cmd[3] = 0; cmd[4] = len; rc = apdu_exchange(cmd, len + 5); if (rc < 0) return(rc); printf("%04X\n", sim_resp_sw); return(0); } cmd_envelope_imm(argc, argv) char **argv; { u_char cmd[260]; int rc; unsigned len; rc = decode_hex_data_from_string(argv[1], cmd + 5, 1, 255); if (rc < 0) return(rc); len = rc; /* ENVELOPE command APDU */ cmd[0] = 0xA0; cmd[1] = 0xC2; cmd[2] = 0; cmd[3] = 0; cmd[4] = len; rc = apdu_exchange(cmd, len + 5); if (rc < 0) return(rc); printf("%04X\n", sim_resp_sw); return(0); }