How to work with SIM cards (Installing an applet)

I have a smart card with the following ATR:

ATR = 3B 9E 94 80 1F 42 80 31 00 73 BE 21 10 66 54 59 53 04 4C 25 CF

Based on the output of atr-parse.appspot.com , I found that it is an MCI (Mobile Communication Company of Iran) SIM card.

This is the information I received from historical bytes:

(compact TLV data object)

Tag: 3, Len: 1 (service data byte)

Card Service Data Byte: 0

  • Access Services EF.DIR and EF.ATR: GET RECORD (s)

  • Card with MF

Tag: 7, Len: 3 (card options)

Selection Methods: 190

  • Record Number Supported

  • Supported short identifier EF

  • Implicit DF Selection

  • DF selection by file ID

  • DF selection along the way

  • Select DF by Full DF Name

Data Encoding Byte: 33

  • Recording Function Behavior: Proprietary

  • The value 'FF' for the first byte of the fields of the BER-TLV tag: valid

  • Quartet data block: 1

Command chain, length fields and logical channels: 16

  • Assignment of logical channel number: on the map

  • Maximum number of logical channels: 1

Tag: 6, Linen: 6 (preliminary data)

Data: 54 59 53 04 4C 25 "TYS.L%"

As you see above, it is mentioned that the card has an MF .

The problem is that I can not do anything with this card. At the first stage I want to list its contents. I looked at the specifications of TS 11.11, TS 102.221, TS 131.102 and TS 151.011.

As far as I understand from the above documents, the system card file consists of a Master File , that its AID 3F00 and some DF-s and EF-s. For example, the basics in this TS 151.011 specification table below, I tried to select some DF-s:

enter image description here

Here are the results:

 Connected to RTP CCID USB Reader 0 ATR: 3B 9E 94 80 1F 42 80 31 00 73 BE 21 10 66 54 59 53 04 4C 25 CF > APDU > A0 A4 04 00 02 5F 30 < 6A 82 > APDU > A4 A4 04 00 00 < 6E 00 > APDU > A0 A4 04 00 00 < 67 00 > APDU > 00 A4 04 00 00 < 61 13 > APDU > 00 C0 00 00 13 < 6F 11 84 09 A0 00 00 00 62 03 01 08 01 A5 04 9F 65 01 FF < 90 00 > APDU > 00 A4 04 00 09 A0 00 00 00 62 03 01 08 01 < 61 13 > APDU > A0 A4 04 00 09 A0 00 00 00 62 03 01 08 01 < 6E 00 > APDU > 00 A4 04 00 09 A0 00 00 00 62 03 01 08 01 < 61 13 > APDU > 00 C0 00 00 13 < 6F 11 84 09 A0 00 00 00 62 03 01 08 01 A5 04 9F 65 01 FF < 90 00 > APDU > 00 A4 04 00 02 3F 00 < 6A 82 > APDU > A0 A4 04 00 02 3F 00 < 6E 00 

As you see above, I failed them all, and I could only find the AID ISD.

I also tried to display the content using the GlobalPlatformPro tool, but it seems that the map does not support the APDU command for the initial update:

 C:\Users\User\Desktop\today>java -jar gp.jar -visa2 -key 47454D5850524553534F53414D504C45 -unlock -list -v -d -i # Detected readers from SunPCSC [*] RTP CCID USB Reader 0 SCardConnect("RTP CCID USB Reader 0", T=*) -> T=0, 3B9E94801F4280310073BE211066545953044C25CF SCardBeginTransaction("RTP CCID USB Reader 0") Reader: RTP CCID USB Reader 0 ATR: 3B9E94801F4280310073BE211066545953044C25CF More information about your card: http://smartcard-atr.appspot.com/parse?ATR=3B9E94801F4280310073BE211066545953044C25CF A>> T=0 (4+0000) 00A40400 00 A<< (0019+2) (249ms) 6F118409A00000006203010801A5049F6501FF 9000 Auto-detected ISD AID: A00000006203010801 ***** Card info: A>> T=0 (4+0000) 80CA9F7F 00 A<< (0000+2) (73ms) 6A86 GET DATA(CPLC) returned SW: 6A86 NO CPLC ***** CARD DATA A>> T=0 (4+0000) 80CA0066 00 A<< (0000+2) (81ms) 6E00 NO CARD DATA ***** KEY INFO A>> T=0 (4+0000) 80CA00E0 00 A<< (0000+2) (82ms) 6E00 A>> T=0 (4+0000) 00CA00E0 00 A<< (0000+2) (60ms) 6E00 GET DATA(Key Information Template) not supported A>> T=0 (4+0008) 80500000 08 FE44F8E8DF60349B 00 A<< (0000+2) (61ms) 6D00 pro.javacard.gp.GPException: INITIALIZE UPDATE failed SW: 6D00 at pro.javacard.gp.GlobalPlatform.check(GlobalPlatform.java:1092) at pro.javacard.gp.GlobalPlatform.openSecureChannel(GlobalPlatform.java:398) at pro.javacard.gp.GPTool.main(GPTool.java:371) C:\Users\User\Desktop\today> 

I want to know what happened? How can I install java card applets on this SIM card?

Please note that I have already successfully worked with Java Card, but I am completely confused by these SIM cards. I understand that anyone can shed light on this issue. Best wishes.

+5
source share
2 answers

If you get a card from the market (and not your own development card), it is almost impossible to install an applet on it, since you do not know the set of its ISD. This is to ensure that only the cardholder and cardholder (MNO) have full control over the contents of the SIM card.

Another possible explanation is that not all SIM cards fully support GP or Javacard. There are existing SIM cards that comply only with the 2G / 3G / 4G standard (GSM 11.11, 11.14, 102.222, etc.), so that the user can authenticate only on the network. Such a SIM card can also use the STK application, but it is not necessarily implemented as a javacard applet.

+2
source

According to your latest log of the Initialize Update command, there may be some features: 1. Scp02 / Scp03 is not supported on your map, there are fewer options if it supports GP. 2. ISD is not configured with parameters supported by SCP. 3. There is another secure channel that previously ran on the same logical channel, on the map.

In my opinion, there may be the last 2 possibilities.

To check the third one, you should try to start Scp02 with the following set of steps: 1. Send a cold reset (PowerON-Power-OFF) 2. Select ISD 3. Send the “Initialize Update” command.

If it does not work, do you need information about the parameters of the ISD application, and from these parameters you can determine whether the ISD supports SCP02 / 03 or not?

These parameters may be: "C9 04 81 02 XX YY" (XX-SCP is supported here, and the "i" value of the YY parameter for SCP).

+1
source

Source: https://habr.com/ru/post/1216594/


All Articles