mirror of https://gerrit.osmocom.org/pysim
fix TypeError in derive_milenage_opc()
In 4f6ca43e1f
we started to use
the bytearray type as 'b' type, but PyCrypto insists on getting
a bytes type.
This fixes the following Exception:
TypeError: argument 1 must be read-only bytes-like object, not bytearray
Change-Id: If2a727ed417ffd56c0f7d7b4e9f633d67fde5ced
Closes: OS#5060
This commit is contained in:
parent
b2edd14475
commit
eab8d2adf7
|
@ -244,9 +244,11 @@ def derive_milenage_opc(ki_hex, op_hex):
|
|||
from pySim.utils import b2h
|
||||
|
||||
# We pass in hex string and now need to work on bytes
|
||||
aes = AES.new(h2b(ki_hex))
|
||||
opc_bytes = aes.encrypt(h2b(op_hex))
|
||||
return b2h(strxor(opc_bytes, h2b(op_hex)))
|
||||
ki_bytes = bytes(h2b(ki_hex))
|
||||
op_bytes = bytes(h2b(op_hex))
|
||||
aes = AES.new(ki_bytes)
|
||||
opc_bytes = aes.encrypt(op_bytes)
|
||||
return b2h(strxor(opc_bytes, op_bytes))
|
||||
|
||||
def calculate_luhn(cc):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue