Attention is currently required from: laforge.
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37931?usp=email )
Change subject: scp: fix key length in dek_encrypt and dek_decrypt ......................................................................
Patch Set 2:
(1 comment)
Commit Message:
https://gerrit.osmocom.org/c/pysim/+/37931/comment/74c33d5e_037b1da9?usp=ema... : PS1, Line 9: When creating the DES cipher object with DES.new, we use the property : card_keys.dek. This property may hold a 16 byte key, but DES uses : an 8 byte key. Pycryptodome does not automatically ignore excess key : bytes. Instead it throws an exception. This means we need to make sure : to supply only the first 8 bytes of card_keys.dek
did you check the spec and determie that this truncation is required/intended? IF yes, it would be […]
Yes, I have checked it. It seems to be an implementation detail of pyCryptoDome. They say: "key (bytes/bytearray/memoryview) – The secret key to use in the symmetric cipher. It must be 8 byte long. The parity bits will be ignored."
In other code locations one can find the truncation as well. I have now put a reference to the pyCryptoDome manual into the commit message. I don't think that we need an extra comment in the code, since it is only a pyCryptoDome related.