FreeCalypso > hg > fc-pcsc-tools
view libcommon/alpha_decode.c @ 74:8562d8508cf2
grcard2-set-{adm,super}-hex commands implemented
It appears that GrcardSIM2 cards allow arbitrary 64-bit keys
for ADM and SUPER ADM, not necessarily consisting of ASCII digits
like the specs require for standard PIN and PUK, and pySim-prog.py
in fact sets the ADM key to 4444444444444444 in hex by default,
which is not an ASCII digit string. If the cards allow such keys,
we need to support them too.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 16 Feb 2021 04:10:36 +0000 |
parents | d4dc86195382 |
children |
line wrap: on
line source
/* * This module contains functions for decoding and displaying alpha fields * that exist in various SIM files. */ #include <sys/types.h> #include <stdio.h> static void print_alpha_field_hex(data, nbytes, outf) u_char *data; unsigned nbytes; FILE *outf; { u_char *dp, *endp; fputs("HEX ", outf); dp = data; endp = data + nbytes; while (dp < endp) fprintf(outf, "%02X", *dp++); } void print_alpha_field(data, nbytes, outf) u_char *data; unsigned nbytes; FILE *outf; { if (!nbytes) { fputs("\"\"", outf); return; } if (data[0] & 0x80) print_alpha_field_hex(data, nbytes, outf); else print_gsm7_string_to_file(data, nbytes, outf); }