From 82c6575a774aee20b9150f83953c84ad51eb22d7 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 10 Jul 2024 18:05:52 +0200 Subject: [PATCH] smpp_ota_apdu2: Re-try decoding PoR without crypto if it fails with If something prevents the response from being ciphered, we need to fall back to plaintext. Change-Id: I748c5690029c28a0fcf39a2d99bc6c03fcb33dbd --- smpp_ota_apdu2.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/smpp_ota_apdu2.py b/smpp_ota_apdu2.py index 60f7863d..48f16ab4 100755 --- a/smpp_ota_apdu2.py +++ b/smpp_ota_apdu2.py @@ -19,7 +19,13 @@ class Foo: def smpp_rx_handler(self, pdu): sys.stdout.write('delivered {}\n'.format(pdu.receipted_message_id)) if pdu.short_message: - dec = self.ota_dialect.decode_resp(self.ota_keyset, self.spi, pdu.short_message) + try: + dec = self.ota_dialect.decode_resp(self.ota_keyset, self.spi, pdu.short_message) + except ValueError: + spi = self.spi.copy() + spi['por_shall_be_ciphered'] = False + spi['por_rc_cc_ds'] = 'no_rc_cc_ds' + dec = self.ota_dialect.decode_resp(self.ota_keyset, spi, pdu.short_message) pp(dec) return None