When the ADF is selected, then this is done by the AID. At the moment
only the first 7 bytes of the AID are used to select the ADF.
sysmo-isim-sja2 tolerates this, but sysmo-usim-sjs1 does not. The Cards
class already has methods to deal with this problem. The method
select_adf_by_aid takes an ADF name and completes the AID from an
internal list. This can be extended to support partial hexadecimal AIDs
as well.
Change-Id: If99b143ae5ff42a889c52e8023084692e709e1b1
Related: OS#4963
Failed reader initializations happen frome time to time, mostly because
of messed up commandline arguments. This results in ugly crashes very
often. Lets control this a bit by catching the exception string and
print it.
Change-Id: I313017355da01bbef7c3d3f1899555aadb509319
IMS public user identity (IMPU)
As per TS1.103, this EF contains one or more records, with each record able
to hold a public SIP Identity (SIP URI) of the user. EF.IMPI consist of URI TLV data
object values see IETF RFC 3261. The URI shall be encoded to an octet string according
to UTF-8 encoding rules as specified in IETF RFC 3629
Reading of EF.IMPU is achieved by first selecting the ISIM application using its AID.
This is followed by selecting EF.IMPU with File ID - 6f04 in ADF.ISIM
Change-Id: Icf78a564aeaf4254658d3b018ff57dfc4b987e6f
IMS private user identity (IMPI)
As per TS1.103 version 14.2.0, this EF contains the private user identity of the user.
EF.IMPI consist of NAI TLV Data object.The NAI shall be encoded to an octet string
according to UTF-8 encoding rules as specified in IETF RFC 3629.
Reading of EF.IMPI is achieved by first selecting the ISIM application using its AID.
This is followed by selecting EF.IMPI with File ID - 6f02 in ADF.ISIM
Change-Id: I8d8e76e3f6b9ca7a0be262fee99cd5a397edbefa
As per TS1.103 version 14.2.0, this EF contains the home operator's network domain name.
The Home Network Domain Name, i.e. FQDN shall be encoded to an octet string
according to UTF-8 encoding rules as specified in IETF RFC 3629
Change-Id: Ia3c68c717d105e10d52a8e9d170480da2ad7d65a
As per 3GPP TS 31.103 version 14.2.0 Release 14, this EF can found under ADF.ISIM at File Id 6f09.
This EF contains one or more Proxy Call Session Control Function addresses.
The first record in the EF shall be considered to be of the highest priority
If ISIM service n°1 and/or service n°5 is available, this file shall be present.
Change-Id: I7a701212c84d3dc5d4c8ccbcf638c97ceda33654
The Address TLV object is used in EF.P-CSCF Address, EF.ePDGId and EF.ePDGIdEm.
See 3GPP TS 31.102 version 13.4.0 Release 13, section 4.2.8, 4.2.102 and 4.2.104.
Address TLV Object format
Tag (1 Byte) - '80'
Length (1 Byte)
Address Type (1 Byte) - '00' (FQDN), '01' (IPv4), '02' (IPv6)
Address (Address Length Bytes)
Change-Id: Ifd8a240f6b5c7736e58a8151295c30ec5b32ed5f
As per TS 31.102, this EF can found under ADF.USIM at File Id 6ff4.
Also, if service n°106 and service n°107 are available, this file shall be present.
Change-Id: I98916e6f5c9791aff63c18a3b16bdfb8ae9b2d36
If the EF.EHPLMN exists, it contains the "Equivalent Home PLMN List".
The odd part of that list is that it is not just a list of additional
PLMN identities, but if the first digits of the IMSI are *not* listed
in EF.EHPLMN, then the MCC/MNC of the IMSI prefix is suddently no
longer considered the home network, but the subscriber is roaming.
See TS 23.122: "If the HPLMN code derived from the IMSI is not present
in the EHPLMN list, then it shall be treated as a Visited PLMN for PLMN
selection purposes."
Change-Id: I22d96ab4a424ec5bc1fb02f5e80165c646a748d3
As per TS 31.102, version 13.4.0 Release 13, this EF can found under ADF.USIM at File Id 6ff3.
Also, if service n°106 and service n°107 are available, this file shall be present.
Change-Id: I68114d328d1af5682a5bc1fa7642882e80b5de4d
the EF files in the USIM ADF are different to the ones int the GSM dir
so added the dictionary to avoid conflicts and hardcoded values
the 'DIR' one was added in ts_51_011.py, not sure if it should be there
as it's not in that standard, but did it for simplicity
Change-Id: I458380bf46b2986662ecdede2551c22cd9be92ba
According to 3GPP TS 27.007, sections 8.17 and 8.18, the modem
may *optionally* provide Generic and/or Restricted SIM Access
to the TE (Terminal Equipment) by means of the AT commands.
This basically means that a modem can act as a card reader.
Generic SIM Access allows the TE to send raw PDUs in the format
as described in 3GPP TS 51.011 directly to the SIM card, while
Restricted SIM Access is more limited, and thus is not really
interesting to us.
This change implements a new transport called ModemATCommandLink,
so using it a SIM card can be read and/or programmed without the
need to remove it from the modem's socket. A downside of this
approach is relatively slow I/O speed compared to PC/SC readers.
Tested with Quectel EC20:
$ ./pySim-read.py --modem-dev /dev/ttyUSB2
Change-Id: I20bc00315e2c7c298f46283852865c1416047bc6
Signed-off-by: Vadim Yanitskiy <axilirator@gmail.com>
pySim-prog and pySim-read currently echo back the pcsc reader id (or
baudrate/socket, depending on the interface used). This makes the output
unecessarly undeterministic, which becomes a problem when verifying the
putput in tests. Lets not echo those variable, user supplied parameters
back. Also lets move the code that does the initalization to utils, so
that it can be used from pySim-prog and from pySim-read (code dup).
Change-Id: I243cc332f075d007b1c111292effcc610e874eb3
Related: OS#4503
As per TS 31.103, This EF indicates which ISIM services are available.
If a service is not indicated as available in the ISIM, the ME shall not select this service.
Parsing of IST is achieved by first selecting the ISIM application using its AID.
This is followed by selecting EF.IST with File ID - 6f07 in ADF.ISIM
Change-Id: I3f0a7227360b72a707dc1bcc4cc9c8a4ec7ad2b2
As per TS.31.102, This EF indicates which USIM services are available.
If a service is not indicated as available in the USIM, the ME shall not select this service.
Parsing of UST is achieved by first selecting the USIM application using its AID.
This is followed by selecting EF.UST with File ID - 6f38 in ADF.USIM
Change-Id: I54dbbd40bd3d22cee81f7c32e58cd946f8564257
Initially the Card is read assuming a UICC SIM, but in case its not, an
error 6e00 will be thrown indicating CLA not supported and Card has just Classic SIM application.
Ref: https://web.archive.org/web/20090630004017/http://cheef.ru/docs/HowTo/APDU.info
The above link provides the bytes to use for CLA, P1, P2 in APDU
Change-Id: Ifea328eff3a381d7b82118e22d2bc0ec5f8a87e4
If AID of the desired ADF is in the list of AIDs of the Card/Card subclass object
then ADF is selected or else None is returned
Change-Id: Ie5f29eec14f099add1d0978e3e7d4ed3c9130854
As per TS.51.011, This EF indicates which services in the SIM are allocated, and whether, if allocated, the service is activated
.If a service is not indicated as available in the SIM, the ME shall not select this service.
Change-Id: Id28a35727adbaaa9df19b1adc621a0c51ad0e51b
This function is used to detect the card type and return Card class/Card subclasses object
if its a know card or else None. Also, an initial step towards refactoring of code.
Change-Id: I71f57c6403dc933bd9d54f90df3d3fe105b4f66f
This change implements parsing of EF.MSISDN (and thus EF.ADN)
as per 3GPP TS 31.102, sections 4.2.26 and 4.4.2.3.
Example (commercial SIM card from 401/02):
EF.MSISDN: ffffffffffffffffffffffffffff07917787028982f7ffffffffffff
Decoded (NPI=1 ToN=1): +77782098287
Note that sysmoUSIM-SJS1 in the test setup has malformed
EF.MSISDN, so that's why the test output is changed.
Change-Id: Ie914ae83d787e3f1a90f9f305bffd45053b8c863