annotate doc/Sysmocom-SIM-notes @ 214:8b1eecb56cb5

simtool code: select_ef_pnn() factored out
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 Mar 2021 08:07:07 +0000
parents 09a66626647d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
123
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 The present suite of tools (fc-simtool and fc-uicc-tool) is NOT a good fit for
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 programming sysmoUSIM-SJS1 and sysmoISIM-SJA2 cards made by Sysmocom and sold
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 in their webshop, because of the following combination of factors:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 1) These cards are primarily USIM/ISIM, with classic GSM 11.11 SIM support
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 regarded as "backward compatibility" - thus they have a lot of important
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 files under ADF.USIM and ADF.ISIM which are not accessible via the classic
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 GSM 11.11 SIM protocol.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 2) Our main feature-rich tool is fc-simtool, but this tool speaks only the
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 classic GSM 11.11 SIM protocol, hence it cannot access any of the USIM/ISIM
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 files.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 3) We have fc-uicc-tool which speaks the UICC protocol that is native to these
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 Sysmocom cards, but it is only a low-level debug tool, not a feature match
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 to fc-simtool.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 The proper long-term solution for our 2G-centric GSM community is to get our own
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 SIMs made, either by paying big bucks to Sysmocom to produce a run of custom
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 cards (presumably based on their current SJA2 platform) with USIM and ISIM
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 removed, leaving only the file system tree under MF that can be fully
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 manipulated via the classic SIM protocol, or preferably by resurrecting the
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 older Grcard SIM-only platform if possible - it may take a long time to find out
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 if the latter option is possible or not. But in the meantime, if someone needs
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 to program a SIM right now, when Sysmocom webshop cards are the only available
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 option, we do have limited support for programming these SIMs:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 * It is possible to authenticate with the ADM1 key from within fc-simtool on
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 both sysmoUSIM-SJS1 and sysmoISIM-SJA2, as explained below.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 * Once you have authenticated with ADM1, you can use fc-simtool admin write
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 commands (write-imsi, SDN phonebook write operations, manual update-bin-imm
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 on various small transparent EFs) just as if you were working with a Grcard
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 SIM.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 * You can also use fc-uicc-tool to access and program every file on Sysmocom
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 cards, including files under ADF.USIM and ADF.ISIM - but in this case you will
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 have to do everything manually in raw hex, with a hex data file for every
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 update-bin and update-rec command.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 Authenticating with ADM1
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 ========================
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 The method for sending your ADM1 key to the card varies depending on whether
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 you are in an fc-simtool or fc-uicc-tool session, and whether your card is
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 sysmoUSIM-SJS1 or sysmoISIM-SJA2. There are 3 possibilities:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 * If you are in an fc-uicc-tool session with either type of card, the command
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 to authenticate with ADM1 is as follows:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 verify-pin 10 xxxxxxxx
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 where xxxxxxxx are the 8 digits of the ADM1 secret code. There are no
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 restrictions as to when this command may be given in an fc-uicc-tool session.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 * If you are in an fc-simtool session with sysmoISIM-SJA2, the command becomes:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 verify-ext 10 xxxxxxxx
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 There are no restrictions as to when this command may be given in an
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 fc-simtool session.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 * If you are in an fc-simtool session with sysmoUSIM-SJS1, the command becomes:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 verify-sjs1-adm1 xxxxxxxx
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 Unlike the other two cases, this command must be issued at the very beginning
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 of your fc-simtool session, before any other commands. If you issue this
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 command later, after some GSM 11.11 SIM APDUs have already been exchanged, it
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 won't work.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 Changing the ADM1 PIN
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 =====================
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 Experiments show that when speaking the UICC protocol to the card, the standard
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 CHANGE PIN command does work on ADM1 on both sysmoUSIM-SJS1 and sysmoISIM-SJA2,
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 thus you can do the following in fc-uicc-tool:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 change-pin 10 old-ADM1 new-ADM1
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 However, given that Sysmocom already assigns individual per-card random ADM1 and
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 communicates these secret codes securely to webshop customers, there does not
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 seem to be any practical need for changing ADM1 further downstream. Thus our
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 recommendation is that if you are going to change your ADM1 PIN just to prove
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 that you can do it, you should then change it back to the original.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 We can only surmise that there probably exist some secret commands that can
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 reset PUK1 and PUK2 after you've authenticated with ADM1, but they will probably
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 remain forever proprietary to Sysmocom, especially given the lack of any
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 practical need for such downstream changing of PUK1/PUK2.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 Thoughts on card (re)formatting
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 ===============================
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 ETSI and 3GPP specs give many more degrees of freedom to SIM card issuers than
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 just the content of various EFs: the card issuer gets to decide which DFs and
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 EFs will be present vs. which ones won't be present at all, and for many EFs
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 the size (allocated space) is variable per the specs and up to the card issuer.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 In the case of record-based EFs, both the record size and the number of records
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 are often left up to card issuers to tune as desired.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 In the Mother's opinion, a truly programmable SIM would be one where every
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 downstream owner of each card (not just the initial factory or the party putting
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 up big bucks for a large custom production run) can do a full reformat: erase
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 the file system and then create whatever tree of DFs and EFs she desires, with
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 full control over each file's allocated size, structure and access conditions.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 In the case of Sysmocom webshop SIMs, we (FreeCalypso) are not aware of any
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 publicly available documents describing how to perform such a reformat - it
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 appears that Sysmocom keeps this knowledge proprietary. In contrast, the older
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 Grcard-based SIMs had some publicly documented commands for erasing the card
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 and creating new directories and files:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 https://osmocom.org/projects/cellular-infrastructure/wiki/GrcardSIM
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 It remains to be seen whether we (FreeCalypso) can get new SIMs from Grcard
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 which are also freely formattable.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 MSISDN misprogramming on early sysmoUSIM-SJS1 cards
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 ===================================================
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 Referring to the previous section regarding formatting degrees of freedom,
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 Sysmocom webshop cards have their EF_MSISDN file allocated as 6 records of 34
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 bytes each. Record length of 34 bytes translates into 20 bytes of alpha tag
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 plus the required 14-byte structure at the end of each record.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 When Sysmocom made their early sysmoUSIM-SJS1 cards, they intended to program
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 the first record of EF_MSISDN as +882110xxxxx, where xxxxx are equal to the last
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 5 digits of their 901-70 IMSI and also to the last 5 content digits (before the
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 Luhn check digit) of their 8988211 ICCID. A correctly structured EF_MSISDN
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 phonebook record with a +882110xxxxx phone number would look like this, for the
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 record size of 34 bytes:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 00: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 10: FF FF FF FF 07 91 88 12 01 xx xx Fx FF FF FF FF
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 20: FF FF
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 The first 20 bytes are all FF because that is the space reserved for the alpha
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 tag, then the phone number is encoded in 8 bytes as 07 91 88 12 01 xx xx Fx,
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 and the rest of the required 14-byte structure is filled with FF bytes.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 However, the actual programming of this MSISDN record on early sysmoUSIM-SJS1
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 cards (at least on the 10-pack I bought in 2017) looks like this:
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 00: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 10: FF FF 07 91 88 12 01 xx xx Fx FF FF FF FF FF FF
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 20: FF FF
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 The not-all-FF field of 8 bytes is written into the wrong location, two bytes
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 earlier than where it should be. When I saw this misprogramming early in the
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 course of developing fc-simtool, I finally understood why the AT+CNUM command
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 on a FreeCalypso modem with this SIM inserted reported a 10xxxxx number instead
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 of the +882110xxxxx listed in the sysmoUSIM manual. :-)
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 When I saw this misprogramming, I also added a fix-sysmo-msisdn command to
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 fc-simtool: this command checks for this particular misprogramming, and if it
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 finds such, it rewrites the MSISDN record with the 8-byte phone number field
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 moved to its correct place. However, this fix-sysmo-msisdn command probably
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 won't get much use: the factory-programmed EF_MSISDN is now completely blank on
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 Sysmocom's current sysmoISIM-SJA2 cards, and also on the late sysmoUSIM-SJS1
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 cards - or at least it is blank on the last-stock cards I bought in 2020-11.
09a66626647d doc/Sysmocom-SIM-notes article written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 EF_MSISDN is writable without needing ADM1 - it only needs CHV1.