utils: fix encoding of EF.MSISDN
The encoding of EF.MSISDN is a bit unstrutured. The encoder function does not return a valid result since it lacks the parameters Capability/Configuration2 Record Identifier and Extension5 Record Identifier, which are mandatory but can be set to 0xFF. Also the encoder gets its input from pySim-shell, so it should have some more input validation, especially when the user encodes an empty string. The encoder and decoder function also do not have unit-tests. Since the encoder now adds the missing two bytes by isself this does not have to be done manually anymore, so cards.py needs to be re-aligned. For pySim-shell.py the encoder is used from ts_51_011.py. Unfortunately it is used wrongly there. The optional Alpha Identifier is required here as well. Related: OS#4963 Change-Id: Iee5369b3e3ba7fa1155facc8fa824bc60e33b55b
This commit is contained in:
@@ -963,7 +963,7 @@ class SysmoUSIMSJS1(UsimCard):
|
||||
# TODO: Extension1 Record Identifier
|
||||
if p.get('msisdn') is not None:
|
||||
msisdn = enc_msisdn(p['msisdn'])
|
||||
data = 'ff' * 20 + msisdn + 'ff' * 2
|
||||
data = 'ff' * 20 + msisdn
|
||||
|
||||
r = self._scc.select_path(['3f00', '7f10'])
|
||||
data, sw = self._scc.update_record('6F40', 1, data, force_len=True)
|
||||
@@ -1356,7 +1356,7 @@ class SysmoISIMSJA2(UsimCard, IsimCard):
|
||||
# TODO: Extension1 Record Identifier
|
||||
if p.get('msisdn') is not None:
|
||||
msisdn = enc_msisdn(p['msisdn'])
|
||||
content = 'ff' * 20 + msisdn + 'ff' * 2
|
||||
content = 'ff' * 20 + msisdn
|
||||
|
||||
r = self._scc.select_path(['3f00', '7f10'])
|
||||
data, sw = self._scc.update_record('6F40', 1, content, force_len=True)
|
||||
|
||||
Reference in New Issue
Block a user