aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2024-06-08ota_apdu2: add example keys of C2Tlaforge/otaHarald Welte1-0/+16
Change-Id: I3aa6efff615bf6a089eb4c0727069c1fdc5883f0
2024-06-08pySim/apdu: fix 51.011Harald Welte1-0/+2
Change-Id: If7d8fdc98fac349bf6dd4ecc9bbc7bea03524489
2024-06-08HACKHarald Welte2-3/+3
Change-Id: Iac752c8ef6cbc085c2f190be1e07a660fe3cd18a
2024-06-08WIPHarald Welte5-22/+68
Change-Id: Id3ae902ffb0a25fb69e2ebb469f925b7482f8d26
2024-06-08ota_test: align with tests/test_ota.py and what our SJA5-S17 sample doesHarald Welte1-7/+7
Change-Id: I0cf003270b7a80f620f8f0bbf6be63e2ce801d3c
2024-06-08pySim/cat: Fix contruct for Address class/IEHarald Welte1-0/+103
Something like "this._.total_len-1" only works during decode. Let's use GreedyBytes instead, working for encode and decode. Change-Id: Idf8326298cab7ebc68b09c7e829bfc2061222f51
2024-06-08WIP: fixup ota_test, smpp2simHarald Welte2-4/+4
Change-Id: I001a353ef66baa08ea014987eb50f0bff65123c0
2024-06-08WIP: export of applicationsHarald Welte3-0/+24
Change-Id: I28a46d3f1054437711dc45455f1d49e87ed1d2df
2024-06-08smpp2sim: CardBase splitHarald Welte1-3/+3
Change-Id: I3f11252ad2173a5ee08db66e4a97441e194d4f7d
2024-06-08fixup smpp.twistedHarald Welte2-0/+2
Change-Id: I44634f35e540625ee669a0ac15a5e249711f6b52
2024-06-08ota_test: data driven testsHarald Welte1-72/+126
Change-Id: I587a1bf78c94732493561f4a5d41c5119e596463
2024-06-08WIP: ota_test: switch to SJA5 sample keysHarald Welte1-15/+36
Change-Id: Iec8c9fbf4232994958371a928a29e6b149976ae4
2024-06-08[UNTESTED] sysmocom_sja2: Support files related to OTA HTTPS featuresHarald Welte1-0/+25
Change-Id: I5710b82c2eea6b6bf5b38882b2a1ec7d60a725d8
2024-06-08ota_testHarald Welte1-0/+57
Change-Id: I9d3f9b16dc885f4e2b864a976d6bc09b3c17b2ee
2024-06-08WIP: vpcd2smpp.pyHarald Welte1-0/+301
Change-Id: I501f2fea075706df379a4bd65a7c6bc19f48277f
2024-06-08WIP: smpp2simHarald Welte1-0/+245
Change-Id: Ie5bae9d823bca6f6c658bd455303f63bace2258c
2024-06-08WIP: classic SIM (3GPP TS 51.011) support.Harald Welte2-1/+339
Change-Id: I1cbbbabd22a67048f3ee9330c12f72c34152ce45
2024-06-08cdma_ruim: Fix unit tests and actually enable themHarald Welte1-1/+1
As pySim.cdma_ruim was not imported by test_files.py, the unit tests were apparently never executed and hence didn't pass. Let's fix both of those problems. Change-Id: Icdf4621eb68d05a4948ae9efeb81a007d48e1bb7
2024-06-08pySim.apdu.ts_102_221: Decode FETCH and TERMINAL RESPONSE bodyHarald Welte2-0/+9
This gives a meaningful decode during pySim-trace. Change-Id: Ifa410e1fefc25e87ffa8e3a2230af80180a36a18
2024-06-08pySim.apdu.ts_102_221: Decode the ENVELOPE command body using pySim.cat TLVHarald Welte1-1/+3
This will decode the ENVELOPE body in pySim-trace further. Before: 00 ENVELOPE - 9000 {'p1': 0, 'p2': 0, 'cmd': 'd14682028381060291978b3c40048111227ff6407070611535002d02700000281516011212000001eae1bd578fa25791898128811b2206cc71639ca292ec2526da8aef4273d2fe2e', 'rsp': '027100001f0a00000100000001200000ab12800101230d08a0000001510000000f829000'} After: 00 ENVELOPE - 9000 {'p1': 0, 'p2': 0, 'cmd': [{'smspp_download': [{'device_identities': {'source_dev_id': 'network', 'dest_dev_id': 'uicc'}}, {'address': {'ton_npi': 145, 'call_number': '79'}}, {'sms_tpdu': {'tpdu': '40048111227ff6407070611535002d02700000281516011212000001eae1bd578fa25791898128811b2206cc71639ca292ec2526da8aef4273d2fe2e'}}]}], 'rsp': '027100001f0a00000100000001200000ab12800101230d08a0000001510000000f829000'} Change-Id: I5ecdbe0b5fa8856cb723569896b73cd49778ed5f
2024-06-08pySim.cat: More TLV Definitions for Event DownloadHarald Welte1-0/+174
Change-Id: I713f12577cab1678cdf97b7ae0e6f3815a42242c
2024-06-08pySim.apdu: Allow TLV based decoders for APDU command and response bodyHarald Welte1-3/+15
So far we only supported construct. Change-Id: Ibb80d328c9a1f464aa5338ca0ca1d6bfb00734e1
2024-06-08pySim-trace: Add support for the TCA Loader log file formatHarald Welte2-0/+56
The "TCA Loader" is a freeware utility program published by the Trusted Connectivity Alliance for testing SCP80, SCP81, SCP02 and SCP03 in UICCs. It can generate text log files of the APDUs it exchanges; let's add this file format to pySim-trace Change-Id: Ie76d36bb18c6bd8968d2a5b74ec1b8c5ccaaa409
2024-06-04global_platform/euicc: Implement obtaining SCP keys from CardKeyProviderHarald Welte2-8/+37
Now that CardKeyProvider is capable of storing key materials transport-key-encrypted, we can use this functionality to look up the SCP02 / SCP03 key material for a given security domain. This patch implements this for the ISD-R and ECASD using a look-up by EID inside the CSV. Change-Id: I2a21f031ab8af88019af1b8390612678b9b35880
2024-06-04CardKeyProvider: Implement support for column-based transport key encryptionHarald Welte4-15/+168
It's generally a bad idea to keep [card specific] key material lying around unencrypted in CSV files. The industry standard solution in the GSMA is a so-called "transport key", which encrypts the key material. Let's introduce support for this in the CardKeyProvider (and specifically, the CardKeyProviderCSV) and allow the user to specify transport key material as command line options to pySim-shell. Different transport keys can be used for different key materials, so allow specification of keys on a CSV-column base. The higher-level goal is to allow the CSV file not only to store the ADM keys (like now), but also global platform key material for establishing SCP towards various security domains in a given card. Change-Id: I13146a799448d03c681dc868aaa31eb78b7821ff
2024-06-04document the CardKeyProviderHarald Welte2-0/+103
Change-Id: Ie6fc24695dd956a4f9fd6f243d3b0ef66acf877b
2024-06-04pySim.esim.saip: Meaningful constructors for [I]SD + SSDHarald Welte1-1/+71
So far the main use case was to read a ProfileElement-SD from a DER file. But when we want to construct one from scratch, we need to have the constructor put some meaningful [default] values into the class members. Change-Id: I69e104f1d78165c12291317326dbab05977a1574
2024-06-04esim.saip: Implement ProfileElement.header_name for more PE typesHarald Welte1-0/+16
We now cover all PE types as of PE_Definitions-3.3.1.asn Change-Id: I37951a0441fe53fce7a329066aebd973389cb743
2024-06-04pySim.esim.saip.validation: Ensure unique PE identification valueHarald Welte1-0/+6
Change-Id: I37b9eb4cfb74de79b0493986d976c8a5f8ccd8ea
2024-06-04esim.saip: Implement SecurityDomainSD.{add,has,remove}_key() methodsHarald Welte1-1/+80
This way it's possible to programmatically inspect and modify the high-level decoded key material inside a securityDomain profile element. Change-Id: I18b1444303de80eaddd840a7e0061ea0098a8ba1
2024-06-04esim.saip: Introduce ProfileElement derived classesHarald Welte1-8/+48
It's rather useful to have derived classes implementing specific functions related to that SAIP profile type. Let's introruce that concept and a first example for securityDomain, where methods allow checking/adding/removing support for SCPs. Change-Id: I0929cc704b2aabddbc2ddee79ab8b674b1ed4691
2024-06-03esim.bsp: Fix a bug in demac_only_one()Harald Welte1-0/+2
When de-MAC-ing at the recipient side, we must increment the cipher(!) block number even if no ciphering is done at all. We did this correctly for MAC (sender) case, but not on the de-MAC (receiver) case. Change-Id: I97993f9e8357b36401d435aaa15558d1c7e411eb
2024-06-03utils: Introduce BER-TLV parsers that return raw tag or even raw TLVHarald Welte2-21/+41
In the eSIM RSP univers there are some rather ugly layering violatoins where ASN.1 cannot be parsed but we have to mess with raw TLVs and the details of DER encoding. Let's add two funtions that make it more convenient to work with this: They return the raw tag as integer, or even the entire encoded TLV rather than the value part only. Change-Id: I1e68a4003b833e86e9282c77325afa86ce144b98
2024-06-02[cosmetic] fix typos in commentsHarald Welte2-2/+2
Change-Id: I549ef7002e6ebef3f13af620cad8d03c7f4d891a
2024-05-30add globalplatform.uiccHarald Welte1-0/+107
GlobalPlatform has a [non-public] "UICC Configuration" spec, which defines some specific aspects of implementing GlobalPlatform in the context of an UICC. Let's add some python definitions about it. Change-Id: If4cb110a9bc5f873b0e097c006bef59264ee48fa
2024-05-30osmo-smdpp: Make error message more descriptiveHarald Welte1-3/+3
Before this patch we had three different error causes that would cause a "Verification failed" error message. Let's state explicitly which part of verification did actually fail. Change-Id: I5030758fe365bb802ae367b494aace5a66bc7a91
2024-05-30osmo-smdpp: Don't re-encode euiccSigned1/euiccSigned2Harald Welte2-4/+41
We used to re-encode those parts of a decoded ASN.1 struct that is cryptographically signed in the GSMA SGP.22 specification. However, if the received data follows a later spec and contains new/unknown records, then our poor-man's attempt at re-encoding will render a different binary, which in turn means the signature check will fail. Let's instead do a manual step-by-step raw decode of the DER TLV structure to extract the actual binary information of parts of ASN.1 objects. Change-Id: I4e31fd4b23ec3be15b9d07c2c30a3e31e22bdda1 Closes: OS#6473
2024-05-30docs/shell: Mention GlobalPlatform and eUICC commands in overviewHarald Welte1-0/+3
Change-Id: I5b6ad752fea09ed9632f150dfbbabf2156a5a9c0
2024-05-26pySim.app: Attempt to retrieve the EID of a SGP.22 / SGP.32 eUICCHarald Welte3-0/+22
... and populate the RuntimeState.identity['EID'] wit it, so other [future] parts of the system can use it. Let's also print the EID (if available) from the 'cardinfo' shell command. Change-Id: Idc2ea1d9263f39b3dff403e1535a5e6c4e88b26f
2024-05-26pySim-shell: Migrate PySimApp.iccid to RuntimeState.identity['ICCID']Harald Welte1-15/+11
In the previous patch, we've introduced a new 'identities' dict as part of the runtime state. Let's migrate our ICCID storage into it for consistency. Change-Id: Ibdcf9a7c4e7e445201640bce33b768bcc4460db1
2024-05-26runtime: Introduce an 'identity' dict for things like ATR, ICCID, EIDHarald Welte2-1/+6
This patch introduces the dict, as well as its first use for ATR storage Change-Id: Ief5ceaf5afe82800e33da233573293527befd2f4
2024-05-26pysim/euicc: Remove duplicated codeHarald Welte1-1/+0
The get_eid command is actually sending the command apdu twice, as it contains both an older implementation (result unused) and the newer one. Change-Id: Ie82bb09f4fc30bc879029b83147dad5614792b48
2024-05-26pySim/commands: STATUS: Use indeterminate length Le/P3 == '00'Harald Welte1-1/+1
Let's have the card tell us what the length is by indicating '00' instead of stating 'FF'. This is better aligned with general practice and won't break assumptions in other parts of the code like SCP transport. Change-Id: Ied63c6e1970e3dfc675da5e5f94579fbb06fea51
2024-05-26pySim/global_platform: Fix install_for_personalization commandHarald Welte1-1/+1
A mix-up betewen underscore and dash resulted in: Change-Id: I49d12b7c7ae2a343940e87d5069c0ae44a9bc50c AttributeError: 'Namespace' object has no attribute 'application_aid'
2024-05-24contrib/sim-rest-client: don't crash without argsOliver Smith1-0/+1
When running without an argument, let argparse print a nice usage error: $ ./sim-rest-client.py usage: sim-rest-client.py [-h] [-H HOST] [-p PORT] [-v] [-n SLOT_NR] {auth,info} ... sim-rest-client.py: error: the following arguments are required: {auth,info} Instead of: $ ./sim-rest-client.py Traceback (most recent call last): File "/usr/share/pysim/contrib/./sim-rest-client.py", line 185, in <module> main(sys.argv) File "/usr/share/pysim/contrib/./sim-rest-client.py", line 181, in main args.func(args) ^^^^^^^^^ AttributeError: 'Namespace' object has no attribute 'func' Change-Id: I92998d9b94dcfb9dcfc3da161fe5d8f45f242b78
2024-05-24pcsc: don't assume opts.pcsc_shared is presentOliver Smith1-1/+1
Fixes running contrib/sim-rest-server.py: builtins.AttributeError: 'Namespace' object has no attribute 'pcsc_shared' Change-Id: I864f65849c5d43cf7c73e60f1935afdf4273f696
2024-05-23pySim/cat: Fix contruct for Address class/IEHarald Welte1-1/+1
Something like "this._.total_len-1" only works during decode. Let's use GreedyBytes instead, working for encode and decode. Change-Id: Idf8326298cab7ebc68b09c7e829bfc2061222f51
2024-05-22sysmocom_sjs2: Make sure 'Const' is importedHarald Welte1-1/+1
File "/crypt/space/home/laforge/projects/git/pysim/pySim/sysmocom_sja2.py", line 180, in __init__ self._construct = Struct(Const(b'\x82'), 'time_unit'/self.TimeUnit, 'value'/Int8ub, ^^^^^ NameError: name 'Const' is not defined Change-Id: If34a48e349680ef84e68a4a1a19dde536ecda0e6
2024-05-22euicc: clarify which eUICCs are supportedHarald Welte1-2/+4
We currently do not support M2M eUICC Change-Id: I3deb9f181075411484158471012ed449c83028fa
2024-05-22pySim-trace.py: Resolve possible variable use before assignmentHarald Welte1-0/+2
pySim-trace.py:198:27: E0606: Possibly using variable 's' before assignment (possibly-used-before-assignment) Change-Id: I28c137a20143b2cd6ea9a0d5461ab61fcd6fe935