aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2023-07-04fixup smpp.twistedlaforge/otaHarald Welte2-0/+2
Change-Id: I44634f35e540625ee669a0ac15a5e249711f6b52
2023-07-04ota_test: data driven testsHarald Welte1-72/+126
Change-Id: I587a1bf78c94732493561f4a5d41c5119e596463
2023-07-04WIP: ota_test: switch to SJA5 sample keysHarald Welte1-15/+36
Change-Id: Iec8c9fbf4232994958371a928a29e6b149976ae4
2023-07-04[UNTESTED] sysmocom_sja2: Support files related to OTA HTTPS featuresHarald Welte1-0/+25
Change-Id: I5710b82c2eea6b6bf5b38882b2a1ec7d60a725d8
2023-07-04ota_testHarald Welte1-0/+57
Change-Id: I9d3f9b16dc885f4e2b864a976d6bc09b3c17b2ee
2023-07-04WIP: vpcd2smpp.pyHarald Welte1-0/+301
Change-Id: I501f2fea075706df379a4bd65a7c6bc19f48277f
2023-07-04WIP: smpp2simHarald Welte1-0/+245
Change-Id: Ie5bae9d823bca6f6c658bd455303f63bace2258c
2023-07-04WIP: classic SIM (3GPP TS 51.011) support.Harald Welte2-1/+339
Change-Id: I1cbbbabd22a67048f3ee9330c12f72c34152ce45
2023-07-04pySim-shell: Support USIM specific methods/commands on unknown UICCHarald Welte1-1/+7
So far, if no known programmable card (like sysmoISIM) has been found, we were using the SimCard base class. However, once we detect an UICC, we should have switched to the UsimCard class, as otherwise the various methods called by USIM/ISIM specific commands don't exist and we get weird 'SimCard' object has no attribute 'update_ust' execptions. The entire auto-detection and the legacy SimCard / UsimCard classes are showing the legacy of the code base and should probably be re-architected. However, let's fix the apparent bug for now. Change-Id: I5a863198084250458693f060ca10b268a58550a1 Closes: OS#6055
2023-06-27ts_31_103: enable encode tests for files containing single TLV IEHarald Welte1-6/+3
Now that we have fixed OS#6073 in the previous commit, we can enable the so-far disabled encoder tests for EF.{DOMAIN,IMPU,IMPI} and remove associated FIXMEs. Change-Id: I79bfc5b77122907d6cc2f75605f9331b5e650286
2023-06-27tlv: Fix IE.from_dict() methodHarald Welte1-2/+5
The existing IE.from_dict() method *supposedly* accepts a dict as input value, but it actually expects the raw decoded value, unless it is a nested IE. This is inconsistent in various ways, and results in a bug visible at a higher layer, such as files like EF.{DOMAIN,IMPI,IMPU}, which are transparent files containing a single BER-TLV IE. Decoding such files worked, but re-encoding them did not, due to the fact that we'd pass a dict to the from_dict method, which then gets assigned to self.decoded and further passed along to any later actual encoder function like to_bytes or to_tlv. In that instance, the dict might be handed to a self._construct which has no idea how to process the dict, as it expects the raw decoded value. Change-Id: I3dd5204510e5c32ef1c4a999258d87cb3f1df8c8 Closes: OS#6073 Related: OS#6072
2023-06-27cosmetic: Implement cmd2.Settable backwards-compat via wrapper classHarald Welte1-24/+18
Let's avoid too many open-coded if-clauses and simply wrap it in a compatibility class. Change-Id: Id234f3fa56fe7eff8e1153d71b9be8a2e88dd112
2023-06-27work-around what appears to be a pylint bugHarald Welte1-0/+2
smpp.pdu.pdu_types.DataCodingScheme.GSM_MESSAGE_CLASS very much exists, and I can prove that manually in the python shell. So let's assume this is a pylint bug and work around it pySim/sms.py:72:21: E1101: Instance of 'DataCodingScheme' has no 'GSM_MESSAGE_CLASS' member (no-member) Change-Id: Iab34bae06940fecf681af9f45b8657e9be8cbc7b
2023-06-25Fix run-editor bug with cmd2 >= 2.0.0 compatibilityHarald Welte2-4/+15
In cmd2, the upstream authors decided to rename a method in 2.0.0 without providing a backwards compatibility wrapper. Let's add that locally. Change-Id: Iaa17b93db13ba330551799cce5f0388c78217224 Closes: OS#6071
2023-06-18tests: Add new, data-driven OTA testsHarald Welte1-0/+137
Rather than writing one test class with associated method for each OTA algorithm / test, let's do this in a data-driven way, where new test cases just have to provide test data, while the code iterates over it. Change-Id: I8789a21fa5a4793bdabd468adc9fee3b6e633c25
2023-06-18Add support for encoding/decoding SMS in TPDU and SMPP formatHarald Welte4-7/+461
This is important when talking OTA with a SIM. Change-Id: I0d95e62c1e7183a7851d1fe38df0f5133830cb1f
2023-06-13docs: Add section on pySim-trace to user manualHarald Welte3-7/+82
Change-Id: I5edb222818f00e36ed5b067e0f8d5786f39ae887
2023-06-11pySim-shell: fix reset commandPhilipp Maier1-3/+3
The API of the lchan object has changed. It no longer features the reset method used by the pySim-shell reset command. Let's fix this by using the reset method of the card object. Change-Id: I55511d1edb97e8fa014724598ec173dd47fe25c1
2023-06-09Add ".py" suffix to sphinx-argparse generated docsHarald Welte4-3/+4
This is important to produce the right command syntax when generating command line reference in the user manual. However, we shouldn't add this kludge to the individual programs, but only to the documentation using the :prog: syntax. Change-Id: I2ec7ab00c63d5d386f187e54755c71ffc2dce429
2023-06-0931.102: Fix EF.Routing_Indicator for odd number of digitsHarald Welte2-7/+11
The routing indicator is BCD-encoded but has an arbitrary length of 1, 2, 3 or 4 digits. In order to support the odd lengths of 1 or 3, we must not pad on the byte level, but on the nibble level. This requires a slight extension of the Rpad() Adapter. Change-Id: I6c26dccdd570de7b7a4cd48338068e230340ec7c Fixes: OS#6054
2023-06-08README: remove redundancy 'Manual' and 'DocumentationHarald Welte1-32/+33
Also, re-order sections oriented more towards the user (Docs first) Change-Id: I4fc76222a1c22685131cb6926721ce24f0373046
2023-06-08README: rephrase initial section; add HPSIM; programmable vs. standardHarald Welte1-9/+18
Change-Id: Ied7bce9fc4ebc9a71093ac41d9c1b8e67fe04d7e
2023-06-08test_ota: Add one first OTA SMS AES128 unit testHarald Welte1-0/+63
Change-Id: Id4a66bbfaec2d8610e8a7a2c72c0dfd08332edcd
2023-06-08SJA5: EF.USIM_AUTH_KEY: Display / enforce proper length TUAK KHarald Welte1-1/+1
The K value in case of TUAK can be 16 or 32 bytes long. We used to permit/parse/display 32 bytes even if only 16 bytes was configured. Let's enforce the correct length of "K". Fixes: OS#6053 Change-Id: Ia0f9a2138f16dce72f3118001e95baa1c80f23ce
2023-06-07ts_31_102: Add shell command for GET IDENTITYHarald Welte3-0/+28
GET IDENTITY is used in the "SUCI computation on USIM" feature. Change-Id: I619d397900dbd6565f8f46acdabcee511903830c
2023-06-07serial: return a return code in reset_card()Philipp Maier1-0/+1
The method reset_card does not return a return code, while the coresponding pcsc implementation does return 1 on success. Change-Id: I658dd6857580652696b4a77e7d6cfe5778f09eff
2023-06-07utils: Remove format_xplmn leading zeros in MNCMatan Perelman3-10/+9
Change-Id: I803edafbd892c2b32b884d0b39fed61967a3d68b
2023-06-07Add FPLMN read and programMatan Perelman7-0/+60
Change-Id: I9ce8c1af691c28ea9ed69e7b5f03f0c02d1f029b
2023-06-07pySim/apdu/ts_31_102.py: Add Rel17 5G NSWO context for GET IDENTITYHarald Welte1-1/+1
Change-Id: I6ce5848ca4cf04430be7767e9cb2d18f4c5a5531
2023-06-07ts_102221: Add "resume_uicc" commandHarald Welte3-1/+32
We've had a "suspend_uicc" command since commit ec95053249bc7f9308ca1f659d8ef6ac97a6e393 in 2021, but didn't yet have the corresponding "resume" pair. Note that you cannot really execute this in a reasonable way from within pySim, as it is required to power-cycle the card between SUSPEND and RESUME, see TS 102 221 Section 11.1.22.3.2 Change-Id: I3322fde74f680e77954e1d3e18a32ef5662759f2
2023-06-07Move "suspend_uicc" command from pySim-shell to ts_102_221.pyHarald Welte3-17/+32
The SUSPEND UICC command is a TS 102 221 (UICC) command, so move it to the UICC Card Profile. Also, make sure that any shell command sets specified in the CardProfile are actually installed during equip(). Change-Id: I574348951f06b749aeff986589186110580328bc
2023-06-06ts_31_102: fix typoPhilipp Maier1-1/+1
Change-Id: Ic8f93a55b974984472356f48518da91c6a521409
2023-06-06Fix result parsing of "suspend_uicc"Harald Welte1-1/+1
prior to this patch, the suspend_uicc command would always cause a python exception as a list of integers was returned by decode_duration rather than a single integer (that can be used with %u format string). Change-Id: I981e9d46607193176b28cb574564e6da546501ba
2023-06-06pySim-shell: Unregister TS 102 222 commands during 'equip'Harald Welte1-1/+1
This avoids error messages about re-registering the same TS 102 222 commands during executing the 'equip' command. Change-Id: I3567247fe84e928e3ef404c07eff8250ef04dfe9
2023-06-06HPSIM application supportHarald Welte2-0/+62
Support HPSIM as specified in 3GPP TS 31.104 Change-Id: I2729fd2b88cd13c36d7128753ad8d3e3d08a9b52
2023-06-05Switch from pycryptodome to pycryptodomexHarald Welte5-7/+8
So for some weird historical reasons, the same python module is available as pycryptodome (Crypto.* namespace) and pycryptodomex (Cryptodome.* namespace). See the following information on the project homepage: https://www.pycryptodome.org/src/installation To make things extra-weird, Debian choose to package pycryptodomex as python3-pycryptodome (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886291). So in order to support both Debian-packaged and differently-installed packages, let's switch to pycryotodomex on all platforms/installers. Change-Id: I04daed01f51f9702595ef9f9e0d7fcdf1e4adb62
2023-06-03OTA: Fix padding of AES CMACHarald Welte1-2/+2
When using AES CMAC for authentication of OTA messages, we must not pad the user data before calling the CMAC function. This is unlike the DES MAC, where padding to the DES block size is mandatory. This bug was discovered when trying to talk OTA with AES to a sysmoISIM-SJA5. This patch makes the OTA AES interoperate with the card. Also, with this patch the cryptographic results of pySim/ota.py are identical to those of the java code org.opentelecoms.gsm0348.impl.crypto.CipheringManager Change-Id: I4b40b5857f95ccb21c35795abe7a1995e368bac3
2023-06-03SJA5: Proper encode/decode of TUAK data in EF.USIM_AUTH_KEYHarald Welte1-3/+33
Unfortunately, TUAK requires a number of additional (and differently-sized) parameters, so the format of EF.USIM_AUTH_KEY differs significantly depending on TUAK or non-TUAK case. Change-Id: I0dcfe05777510fb34973dc2259b137133d8e199d
2023-06-03SJA5: Add TUAK + XOR-2G algorithm definitions for EF_[U]SIM_AUTH_KEYHarald Welte1-2/+2
Change-Id: I62a7255d991fa1ed09a7c9bcf8be4b68acfa61a7
2023-06-03SJA2: Implement DF.SYSTEM/EF.0348_KEY using constructHarald Welte2-13/+29
This implicitly adds support for JSON->binary encoding, not just decoding (previous code predating construct support). Change-Id: I0994d9f66a504dd3c60b43ed5cf6645515dcbc6a
2023-06-03ts_31_102: EF_SUPI_NAI: Decode/Encode GLI+GCI as UTF-8 stringsHarald Welte1-2/+2
According to TS 23.003 Section 28.15 and 28.16 both GLI and GCI are NAI as defined in IETF RFC 7542, which in turn specifies they are encoded in UTF-8. Change-Id: I0a82bd0d0a2badd7bc4a1f8de2c3e3c144ee5b12
2023-06-03ts_31_102: Add decoder/encoder for DF.5GS/EF.Routing_IndicatorHarald Welte2-5/+12
This file is rather important for 5G SA operation, so we should have a proper encoder/decoder in place. Change-Id: I1b37fdfc2807976880b2cafb61951f08eebeb344
2023-06-02modem_atcmd: raise ProtocolError instead of ReaderError on CME ERRORTobias Engel2-2/+3
Also accept ProtocolError in addition to SwMatchError in filesystem.py when probing for applications Change-Id: I82b50408328f8eaaee5c9e311c4620d20f930642
2023-05-28setup.py: fix syntax errors (missing commas)Vadim Yanitskiy1-3/+3
Change-Id: Ia53a659ad9652d582e2bf4a039a3e18631435072 Fixes: 2b15e315 "setup: add missing pyyaml to setup.py and README.md" Fixes: 93aac3ab "pySim-shell: fix compatibility problem with cmd2 >= 2.0.0 (Settable)"
2023-05-27cards: Add support for Gialer SIM cardsMatan Perelman1-1/+64
Change-Id: Icd2021aec630ac018f66ab565e03112047389e17
2023-05-27docs: add SUPI/SUCI usage exampleMerlin Chlosta3-2/+206
Change-Id: I2908ea9df7e78c596554731085902e2ab7278328
2023-05-25cards.py: support ATR-based detection of sysmoISIM-SJA5Harald Welte2-3/+61
The cards are 99% software-compatible to the SJA2, so let's just derive the SJA5 class from the SJA2 Change-Id: I706631baaf447c49904277886bc9a3f6ba3f5532
2023-05-25ts_31_102: Add DF.SAIP supportHarald Welte1-0/+13
DF.SAIP (SIMalliance Interoperable Profile) is not part of 31.102, but something from the eSIM/eUICC universe of TCA (formerly known as SIMalliance). However, as 3GPP does not specify how/where the card stores the information required for SUCI calculation, the TCA/SIMalliance standard is the only standard there is. Some CardOS start to use this standard even for non-eSIM/eUICC use cases. Change-Id: Iffb65af335dfdbd7791fca9a0a6ad4b79814a57c
2023-05-25ts_31_102: Fix FID + SFI of EF.MCHPPLMNHarald Welte1-1/+1
Change-Id: I7e24c904e47cc6f90e90b8634cbed478bd14231f
2023-05-25ts_31_102: Fix FID of EF.OPL5G (it's 4F08 instead of 6F08)Harald Welte1-1/+1
Change-Id: I68c7ad93dabd768d80ae629498aee29d7bab5542