diff options
author | Harald Welte <laforge@osmocom.org> | 2023-05-27 15:58:57 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2023-07-04 21:17:19 +0200 |
commit | c4d7e1fc356c715245b979492a899946d14a9702 (patch) | |
tree | 6b4bfa63f5041ea5682070b9317364dee0f7606a | |
parent | 25dfaf98f2c000251588cddeac6bf0cd92833e1a (diff) |
WIP: ota_test: switch to SJA5 sample keys
Change-Id: Iec8c9fbf4232994958371a928a29e6b149976ae4
-rwxr-xr-x | ota_test.py | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/ota_test.py b/ota_test.py index dad4de1..4f5b295 100755 --- a/ota_test.py +++ b/ota_test.py @@ -11,10 +11,16 @@ from pySim.utils import h2b, h2b #KID3 = h2b('ECAE122B0E6AE4186D6487D50FDC0922') # KIC1 + KID1 of 8988211000000467285 -KIC1 = h2b('D0FDA31990D8D64178601317191669B4') -KID1 = h2b('D24EB461799C5E035C77451FD9404463') -KIC3 = h2b('C21DD66ACAC13CB3BC8B331B24AFB57B') -KID3 = h2b('12110C78E678C25408233076AA033615') +#KIC1 = h2b('D0FDA31990D8D64178601317191669B4') +#KID1 = h2b('D24EB461799C5E035C77451FD9404463') +#KIC3 = h2b('C21DD66ACAC13CB3BC8B331B24AFB57B') +#KID3 = h2b('12110C78E678C25408233076AA033615') + +# KIC + KID for SJA5 samples +KIC1 = h2b('100102030405060708090a0b0c0d0e0f') +KID1 = h2b('101102030405060708090a0b0c0d0e0f') +KIC3 = h2b('300102030405060708090a0b0c0d0e0f') +KID3 = h2b('301102030405060708090a0b0c0d0e0f') od = OtaKeyset(algo_crypt='triple_des_cbc2', kic_idx=3, kic=KIC3, algo_auth='triple_des_cbc2', kid_idx=3, kid=KID3) @@ -28,8 +34,7 @@ dialect = OtaDialectSms() # USIM RFM: B00011 tar = h2b('B00011') -spi = {'counter':'no_counter', 'ciphering':True, 'rc_cc_ds': 'cc', 'por_in_submit':False, - 'por_shall_be_ciphered':True, 'por_rc_cc_ds': 'cc', 'por': 'por_required'} +spi = {'counter':'no_counter', 'ciphering':True, 'rc_cc_ds': 'cc', 'por_in_submit':False, 'por_shall_be_ciphered':True, 'por_rc_cc_ds': 'cc', 'por': 'por_required'} outp = dialect.encode_cmd(od, tar, spi, apdu=b'\x00\xa4\x00\x04\x02\x3f\x00') print("result: %s" % b2h(outp)) @@ -37,21 +42,37 @@ with_udh = b'\x02\x70\x00' + outp print("with_udh: %s" % b2h(with_udh)) +# processing of the response[s] from the card + da = AddressField('12345678', 'unknown', 'isdn_e164') #tpdu = SMS_SUBMIT(tp_udhi=True, tp_mr=0x23, tp_da=da, tp_pid=0x7F, tp_dcs=0xF6, tp_udl=3, tp_ud=with_udh) tpdu = SMS_DELIVER(tp_udhi=True, tp_oa=da, tp_pid=0x7F, tp_dcs=0xF6, tp_scts=h2b('22705200000000'), tp_udl=3, tp_ud=with_udh) print(tpdu) print("tpdu: %s" % b2h(tpdu.toBytes())) -spi = {'counter':'no_counter', 'ciphering':True, 'rc_cc_ds': 'cc', 'por_in_submit':False, - 'por_shall_be_ciphered':True, 'por_rc_cc_ds': 'cc', 'por': 'por_required'} -dialect.decode_resp(od, spi, '027100001c12b000119660ebdb81be189b5e4389e9e7ab2bc0954f963ad869ed7c') +print() + +if True: + print("SPI with ciphered PoR") + spi = {'counter':'no_counter', 'ciphering':True, 'rc_cc_ds': 'cc', 'por_in_submit':False, + 'por_shall_be_ciphered':True, 'por_rc_cc_ds': 'cc', 'por': 'por_required'} + #dialect.decode_resp(od, spi, '027100001c12b000119660ebdb81be189b5e4389e9e7ab2bc0954f963ad869ed7c') + r = dialect.decode_resp(od, spi, '027100001c12b000118bb989492c632529326a2f4681feb37c825bc9021c9f6d0b') + print(r) -spi = {'counter':'no_counter', 'ciphering':True, 'rc_cc_ds': 'cc', 'por_in_submit':False, - 'por_shall_be_ciphered':False, 'por_rc_cc_ds': 'cc', 'por': 'por_required'} -dialect.decode_resp(od, spi, '027100001612b000110000000000000055f47118381175fb01612f') +if True: + print("SPI with un-ciphered PoR") + spi = {'counter':'no_counter', 'ciphering':True, 'rc_cc_ds': 'cc', 'por_in_submit':False, + 'por_shall_be_ciphered':False, 'por_rc_cc_ds': 'cc', 'por': 'por_required'} + #dialect.decode_resp(od, spi, '027100001612b000110000000000000055f47118381175fb01612f') + r = dialect.decode_resp(od, spi, '027100001612b0001100000000000000b5bcd6353a421fae016132') + print(r) -spi = {'counter':'no_counter', 'ciphering':True, 'rc_cc_ds': 'cc', 'por_in_submit':False, - 'por_shall_be_ciphered':False, 'por_rc_cc_ds': 'no_rc_cc_ds', 'por': 'por_required'} -dialect.decode_resp(od, spi, '027100000e0ab000110000000000000001612f') +if True: + print("SPI without ciphering or cryptographic checksum") + spi = {'counter':'no_counter', 'ciphering':True, 'rc_cc_ds': 'cc', 'por_in_submit':False, + 'por_shall_be_ciphered':False, 'por_rc_cc_ds': 'no_rc_cc_ds', 'por': 'por_required'} + #r = dialect.decode_resp(od, spi, '027100000e0ab000110000000000000001612f') + r = dialect.decode_resp(od, spi, '027100000e0ab0001100000000000000016132') + print(r) |