laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/33234
)
Change subject: SJA5: EF.USIM_AUTH_KEY: don't display padding of TUAK K
......................................................................
SJA5: EF.USIM_AUTH_KEY: don't display padding of TUAK K
The K value in case of TUAK can be 16 or 32 bytes long. In case
of the 16 byte variant, it is padded with FF to the end. Use Rpad()
to remove that padding.
This is not perfect, as it would also strip any consecutive ff even
at the end of the first 16 bytes (when displaying). But then, this is
a rather artificial situation, as proper keys have high entropy and there
shouldn't be any consecutive ff... at any point in it.
Change-Id: Ia0f9a2138f16dce72f3118001e95baa1c80f23ce
---
M pySim/sysmocom_sja2.py
1 file changed, 19 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/34/33234/1
diff --git a/pySim/sysmocom_sja2.py b/pySim/sysmocom_sja2.py
index 8b1fc04..b5fbd2b 100644
--- a/pySim/sysmocom_sja2.py
+++ b/pySim/sysmocom_sja2.py
@@ -207,7 +207,7 @@
'tuak_cfg'/TuakCfgByte,
'num_of_keccak_iterations'/Int8ub,
'op_opc'/HexAdapter(Bytes(32)),
- 'k'/HexAdapter(Bytes(32)))
+ 'k'/HexAdapter(Rpad(Bytes(32))))
def _decode_bin(self, raw_bin_data: bytearray) -> dict:
if raw_bin_data[0] & 0x0F == 0x06:
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/33234
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ia0f9a2138f16dce72f3118001e95baa1c80f23ce
Gerrit-Change-Number: 33234
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange