What encryption algorithms does sysmoISIM-SJA5 support for ota security?

Hello,

Are all the algorithms(DES/2DES/3DES, AES128/192/256, CRC16/32, SHA1/224/256, MD5, HMAC) written in the sysmoISIM-SJA5 user manual valid for OTA security?

Does sysmoISIM-SJA5 run OTA without encryption? (SPI = 0x00, KIc=0x00 and KID=0x00).

Even though I have enabled encryption (CMAC) for SIM card SMS-PP, I am constantly getting ‘06’ response for each attempt.

‘06’ Response Status Code : Unidentified security error. This code is for the case where the Receiving Entity cannot correctly interpret the Command Header and the Response Packet is sent unciphered with no RC/CC/DS.

It depends on how the card is configured. Each card can actually be individually configured regarding which algorithm[s] and key length shall be used. I personally have not used OTA much, and mainly focused on SCP02 / SCP03 in most of my work.

Of course not! That would be super insecure. I thought we documented the MSL somewhere in he manual? And indeed, MSL is specifically specified as 0x06 for RAM+RFM.

The OTA features of sysmoISIM-SJA5 have been used successfully with the OTA code in the pySim repository.

The OTA keyset should be enabled with OtaKeyset(algo_crypt='aes_cbc', algo_auth='aes_cmac') as well as a valid set of the card-specific kic_idx, kic, kid_idx and kid.

If you are using any other or custom code, I suggest you use the pysim.ota OtaKeyset and OtaDialectSms classes first. Once they work, adjust your other/custom code to match what the pysim code does.

1 Like

@laforge thanks for your reply.

I wrote some code for myself based on the “ota_test.py” file in your pysim.ota branch. I encoded secure data for AES-128. I replaced the kic, kid values in ota_test.py with the kic, kid values of my own SJA5 SIM card. I verified that both the pysim.ota result and the results from my own code were identical. When I sent the encoded code to the SIM card, I received a “06” response every time.
Later, when I encoded with DES3, I saw that the problem was solved. The SIM card now started returning a “01 (por-ok)” response. I think there might be an issue with SJA5’s AES decryption, I’m not sure.

First, I have a question I’m curious about. When we type the “pySIM-shell (00:MF)> tree” command in pysim, are the files listed in the command output located within the TAR applications? After solving the problem, I tried to experiment with the TAR applications mentioned in the reference manual. For example, when I try to read DF.GSM->EF.IMSI or DF.TELECOM->MSISDN information, I get a “File not found” error.

First, I successfully perform the Select File steps: 00A40800023F00(MF), 00A40800027f20(DF.GSM). Under DF.GSM (pySIM-shell (00:MF)> tree DF.GSM 7f20 GSM Network related files EF.LP 6f05 Language Preference EF.IMSI 6f07 IMSI EF.Kc 6f20 Ciphering key Kc EF.PLMNsel 6f30 PLMN selector and continuing lines…) I could not access any of the files.
Container:
number_of_commands = 1
last_status_word = u’6a82’ (total 4)
last_response_data = u’’ (total 0)
Wrong parameters - File not found

How can I find out what information is contained within the TAR applications (RAM-RFM) in the reference manual?

Now I’m a bit confiused: OTA using SCP80 / TS 03.48 is specified as using 3DES. Which 3GPP or ETSI spec did you find for SCP80 ever using AES key material?

The sysmoISIM-SJA5 is using AES for SCP03 (tested, with pySim) and SCP81 (untested, as there’s no FOSS implementation of TLS-PSK and python up to 3.12 didn’t support it either). But SCP80 and SCP02 are specified for 3DES (both tested, with pySim).

I’m not sure I understand the question?

  • theres RAM (remote application management), which has nothing to do with filesystem contents, but loading/installing of java applets,
  • there’s two instances for RFM: One for the USIM application and one for the “root file system”, i.e. DF.GSM, DF.TELECOM and MF.

None of the above should be specific to sysmoISIM-SJA5; this is again ETSI/3GPP standard behaviour, as far as I can tell?

I initially thought the “AES128/192/256 for OTA security” feature mentioned in the sysmoISIM-SJA5 manual was a general capability. In addition, when I saw the “AES128-SJA5-CIPHERED-CC” test case in the “ota” branch of pysim, I first tried AES128 encryption. Since I’ve only recently started working with SIM and OTA SMS, this was my inexperience — I’m sorry

What I’m actually trying to say here is that I wanted to read the information in the RFM files via OTA SMS. My mistake was sending only a single command in one OTA SMS. However, combining all the commands in a single OTA SMS solved the problem. Thank you for your support.

In hindsight, I think you are right. I did implement + test AES based SCP80, I just somehow remembered it wrong. Given that I didn’t use it ever since implementing + testing it (for sure with SJA5 cards), I can’t currently comment on what the spceific problem may be.

Maybe @pmaier can check if the symocom sim-tester setup currently has any continuous/automatic testing of not just SCP02 + SCP03 but also SCP80 OTA encryption against SJA5 cards? And if so, using just DES or also AES?

Hello @laforge and @Anda,

I have checked back the global platform tests on the tester. We test SCP02 with sysmoISIM-SJA5-S17 and sysmoISIM-SJA2. SCP03 is tested against sysmoEUICC1-C2T only. There are no OTA related testcases yet.

(Maybe we should add some testcases now. I think It may definitely be helpful to have an integration test for that part as well.)

Best regards.
Philipp Maier

1 Like

I’ve created Bug #6868: pySim.ota codebase is not automatically testsed against real-world cards - pySim - Open Source Mobile Communications to track this. There will be some lead time until we have time and resources to investigate.