Let's rename get_file_for_selectable to get_file_for_filename so that it
is immediately clear what the method does.
Related: OS#6092
Change-Id: Ifed860814229857ad8b969e50849debbf5d8918f
In the past, we always wrapped a HexAdapter around bytes-like data in
order to make sure it's printed as hex-digits. However, now that we are
doing JSON output it's much easier to let the pySim.utils.JsonEncoder
take care of this in a generic way.
We should do a similar migration all over pySim (pySim-shell,
filesystem, etc.) - but for now only do it in the low-hanging fruit of
pySim-trace aka pySim.apdu
Change-Id: I0cde40b2db08b4db9c10c1ece9ca6fdd42aa9154
Let's factor out the "automatic processing using _tlv / _construct" as a
separate method. This way we enable a derived class to first call that
automatic processing method, and then amend its output in a second step.
Change-Id: I1f066c0f1502020c88d99026c25bf2e283c3b4f5
This is requird to make some definitions available to USIM / ts_31_102
without introducing circular dependencies.
Change-Id: I32e29f400d2da047e821bf732316b21805b5a1e2
As SGP.22 states, the handleNotification endpoint uses HTTP status 204,
not 200 (due to its empty body).
Change-Id: I890bdbd3e1c4578d2d5f0367958fdce26e338cac
This implements the first parts of the "GlobalPlatform Remote
Application Management over HTTP Card Specification v2.3 - Amendment B,
Versoin 1.2". Specifically, this patch covers the TLV definitions for
the OTA message used for HTTPS session triggering.
This also adds some more unit test coverage to pySim.cat, based on
real-world data that was captured nested inside the HTTPS Administration
session triggering parameters.
Change-Id: Ia7d7bd6df41bdf1249011bad9a9a38b7669edc54
this way, the eUICC will send us notifications whenever our profiles are
enabled/disabled/deleted.
Change-Id: I2861290864522b691b30b079c7c2e1466904df2d
The ES9+ interface is not only used for downloading eSIM profiles, but
it is also used to report back the installation result as well as
profile management operations like enable/disable/delete.
Change-Id: Iefba7fa0471b34eae30700ed43531a515af0eb93
For example, the ES9+ handleNotification function is defined with an
empty response body, so we cannot unconditionally assume that every HTTP
response will contain a JSON "header" value.
Change-Id: Ia3c5703b746c1eba91f85f8545f849a3f2d56e0b
TS 102 221 specifies that (in case of a class 4 command) and as SW
62xx or 63xx, we should send a GET RESPONSE just like in the 61xx
case in order to get the respective response.
As we don't really know if it's a case1/2/3/4 command in the
pySim.transport, let's always send the GET RESPONSE in case SW 62xx or
63xx are received. It shouldn't hurt - in the worst case there's no
response available...
Change-Id: Ibb1398194a16fc1f1f9bc46af6c66fb6575240cd
SMS cannot exceed 140 bytes, and TS 31.115 explicitly states that larger
messages must use multi-part SMS, which we don't yet implement here.
Change-Id: I8a1543838be2add1c3cfdf7155676cf2b9827e6e
while it's true that in situations where response_status == 'por_ok'
we are guaranteed to have a 'secured_data' key in the dict, its value
could well be b'', which in turn causes us to run into an exception,
calling a decoder on an empty byte value; let's avoid that.
Change-Id: I7c919f9987585d3b42347c54bd3082a54b8c2a0a
the COMPACT-TLV variant is a TLV variant that ISO7816 uses for encoding
tag and length into a single octet. This is used (for example) in ATR
historical bytes.
Let's add support for this to our pySim TLV encoder/decoder.
Change-Id: I9e98d150b97317ae0c6be2366bdaaeaeddf8031c
The ProfileHeader PE contain lists of template-oids and services that
are mandatory in this profile. Let's add methods that can be used to
(re-) compute those lists based on the actual PE contents of the
sequence.
The idea is that during programmatic construction of a profile, those methods
would be called after appending all PEs, just before encoding the
profile as DER.
Change-Id: Ib43db8695c6eb63965756364fda7546d82df0beb
Let's avoid the copy+paste in the subclass constructors and initialize the profile
element header in the base class constructor.
Change-Id: I6e69ae1f0d33d963247fc506db33b3840c10c19a
There are e.g. templates for usim and for opt-usim, and they should not
be confused with each other. Let's reflect that in the naming.
Change-Id: Ic6d04ce3172dc969c6b8c018b8d305eb6fd3f550
Let's make sure the constructor of ProfileElement subclasses set
meaningful defaults to the self.decoded member, so that the to_der()
method can actually encode it. This is required when constructing
a profile from scratch, as opposed to loading an existing one from DER.
Also, add a test to verify that the encoder passes without exception;
doesn't test the generated binary data.
Change-Id: I401bca16e58461333733877ec79102a5ae7fe410
This fixes commit cdf661b24c
"pySim.tlv.COMPR_TLV_IE: Patch comprehension bit if derived class misses it"
where we introduce a comprehension-TLV specific derived metaclass, which forgets
to pass the kwargs through to the parent metaclass.
Change-Id: If65a8169bcf91bb2f943d0316f1140e07f0b8b8e
This new action can be used to dump all java applications as either raw
IJC file or converted to CAP format (the usual format generated by
JavaCard toolchains).
Change-Id: I51cffa5ba3ddbea491341d678ec9249d7cf470a5
So far we only implemented command encoding and response decoding.
Let's also add command decoding, which is useful for example when
decoding protocol traces.
Change-Id: Id666cea8a91a854209f3c19c1f09b512bb493c85
This is a tool to work with eSIM profiles in SAIP format. It allows
to dump the contents, run constraint checkers as well as splitting
of the PE-Sequence into the individual PEs.
Change-Id: I396bcd594e0628dfc26bd90233317a77e2f91b20
Our current implementation assumes that all COMPR_TLV_IE are created
with a raw tag value that has the comprehension bit set. Check for this
during the class __new__ method and print a warning if we have to fix it up
Change-Id: I299cd65f32dffda9040d18c17a374e8dc9ebe7da
our implementation currently assumes that all derived classes are
created with a tag value that has the comprehension bit set.
Change-Id: I6e5f2a69c960c03015c3f233f8fbc2a7a802f07e
The uppermost bit of COMPREHENSION-TLV tags indicates whether the
recipient is required to "comprehend" that IE or not. So every IE
actually has two tag values: one with and one without that bit set.
As all our existing TLV definitions of COMPR_TLV_IE have that bit set,
let's assume this is the default, but use the same definition also for
the situation where that bit is not set.
Change-Id: I58d04ec13be0c12d9fb8cb3d5a0480d0defb6c95
This method allows the caller to remove all NAAs of a certain type,
for example to remove all CSIM instances from a given profile.
Change-Id: I64438bf0be58bad7a561c3744b7e9b1338a7857c
This tool can be used to test the SM-DP+. It implements the full dance
of all HTTPs API operations to get to the downloadProfile, and will
decrypt the BPP to the UPP, which is then subsequently stored as file on
disk.
Needless to say, this will only work if you have an eUICC certificate +
private key that is compatible with the CI of your SM-DP+.
Change-Id: Idf8881e82f9835f5221c58b78ced9937cf5fb520