mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-16 18:38:32 +03:00
Never use Bytes without any 'Adapter'
Otherwise we have binary/bytes as values inside the dict, rather than a hexadecimal string. That's ugly when printing without json formatting. Change-Id: Ia3e7c4791d11bd4e3719a43d58e11e05ec986d1f
This commit is contained in:
@@ -142,13 +142,12 @@ class EF_SIM_AUTH_KEY(TransparentEF):
|
||||
'use_opc_instead_of_op'/Bit,
|
||||
'algorithm'/Enum(Nibble, milenage=4, comp128v1=1, comp128v2=2, comp128v3=3))
|
||||
self._construct = Struct('cfg'/CfgByte,
|
||||
'key'/Bytes(16),
|
||||
'op' /
|
||||
If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op, Bytes(
|
||||
16)),
|
||||
'key'/HexAdapter(Bytes(16)),
|
||||
'op'/ If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op,
|
||||
HexAdapter(Bytes(16))),
|
||||
'opc' /
|
||||
If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op, Bytes(
|
||||
16))
|
||||
If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op,
|
||||
HexAdapter(Bytes(16)))
|
||||
)
|
||||
|
||||
|
||||
@@ -198,13 +197,13 @@ class EF_USIM_AUTH_KEY(TransparentEF):
|
||||
'use_opc_instead_of_op'/Bit,
|
||||
'algorithm'/Enum(Nibble, milenage=4, sha1_aka=5, xor=15))
|
||||
self._construct = Struct('cfg'/CfgByte,
|
||||
'key'/Bytes(16),
|
||||
'key'/HexAdapter(Bytes(16)),
|
||||
'op' /
|
||||
If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op, Bytes(
|
||||
16)),
|
||||
If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op,
|
||||
HexAdapter(Bytes(16))),
|
||||
'opc' /
|
||||
If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op, Bytes(
|
||||
16))
|
||||
If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op,
|
||||
HexAdapter(Bytes(16)))
|
||||
)
|
||||
|
||||
|
||||
@@ -216,13 +215,13 @@ class EF_USIM_AUTH_KEY_2G(TransparentEF):
|
||||
'use_opc_instead_of_op'/Bit,
|
||||
'algorithm'/Enum(Nibble, milenage=4, comp128v1=1, comp128v2=2, comp128v3=3))
|
||||
self._construct = Struct('cfg'/CfgByte,
|
||||
'key'/Bytes(16),
|
||||
'key'/HexAdapter(Bytes(16)),
|
||||
'op' /
|
||||
If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op, Bytes(
|
||||
16)),
|
||||
If(this.cfg.algorithm == 'milenage' and not this.cfg.use_opc_instead_of_op,
|
||||
HexAdapter(Bytes(16))),
|
||||
'opc' /
|
||||
If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op, Bytes(
|
||||
16))
|
||||
If(this.cfg.algorithm == 'milenage' and this.cfg.use_opc_instead_of_op,
|
||||
HexAdapter(Bytes(16)))
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user