简体   繁体   English

通过OTA删除JavaCard小程序

[英]Delete JavaCard applet through OTA

I have an applet installed on a JavaCard. 我在JavaCard上安装了一个applet。 I want to delete this applet through over the air(OTA) message by sending APDU commands. 我想通过发送APDU命令通过空中(OTA)消息删除此applet。 following are the APDU command I send through card reader to delete th applet: 以下是我通过读卡器发送的用于删除小程序的APDU命令:

1)  A4 04 00 00
2)  ExAuth 00 02 00 01 00 404142434445464748494A4B4C4D4E4F
3)  80 E4 00 00 0D 4F 0B A0 00 00 00 00 01 02 03 03 01 02
4)  80 E4 00 00 0D 4F 0B A0 00 00 00 00 01 02 03 03 00 00

I have followed this : https://adywicaksono.wordpress.com/2008/05/21/understanding-gsm-0348/ 我已经遵循了这个: https : //adywicaksono.wordpress.com/2008/05/21/understanding-gsm-0348/

But I have not been able to delete the applet as there is some error everytime. 但是我无法删除小程序,因为每次都会出现一些错误。 Thank You. 谢谢。

Under my assumption that your JavaCard is using the Global Platform framework (which almost every JavaCard does) you need to perform the following steps: 根据我的假设,您的JavaCard使用的是Global Platform框架(几乎每个JavaCard都使用该框架),您需要执行以下步骤:

  1. Select CardManager 选择CardManager
  2. Authenticate 认证
  3. Delete the applet 删除小程序

You probably succeeded the first step, although selecting the Cardmanager by its AID is the better way to go. 尽管通过AID选择Cardmanager是更好的方法,但您可能成功完成了第一步。 The second step looks a bit weird to me from what you posted. 从您发布的内容来看,第二步对我来说有点奇怪。 The third step looks good as well. 第三步看起来也不错。

To authenticate there are diffrent protocols, eg SCP01, SCP02, etc. SCP02 is the de facto standard for modern cards. 要进行身份验证,有不同的协议,例如SCP01,SCP02等。SCP02是现代卡的事实上的标准。 Then of course you also need the right keys to authenticate, for most cards delivired there are the default keys that you already have. 然后,当然,您还需要正确的密钥进行身份验证,对于大多数使用Delivired的卡,已经有默认密钥。 The exact procedure is explained in the Global Platform specification. 确切的过程在Global Platform规范中进行了说明。 A sample log from my tool looks like this: 我的工具中的示例日志如下所示:

  => 00 A4 04 00 08 A0 00 00 01 51 00 00 00 00          .........Q....
 (9407 usec)
 <= 6F 64 84 08 A0 00 00 01 51 00 00 00 A5 58 9F 65    od......Q....X.e
    01 FF 9F 6E 06 47 91 23 47 41 00 73 49 06 07 2A    ...n.G.#GA.sI..*
    86 48 86 FC 6B 01 60 0B 06 09 2A 86 48 86 FC 6B    .H..k.`...*.H..k
    02 02 02 63 09 06 07 2A 86 48 86 FC 6B 03 64 0B    ...c...*.H..k.d.
    06 09 2A 86 48 86 FC 6B 04 02 55 65 0B 06 09 2B    ..*.H..k..Ue...+
    85 10 86 48 64 02 01 03 66 0C 06 0A 2B 06 01 04    ...Hd...f...+...
    01 2A 02 6E 01 02 90 00                            .*.n....
Status: No Error
cm>  set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
cm>  init-update 255
 => 80 50 00 00 08 7D 62 4D F4 89 F6 07 E3 00          .P...}bM......
 (55368 usec)
 <= 00 00 42 87 00 17 97 93 24 74 FF 02 00 01 3C 2B    ..B.....$t....<+
    97 86 B8 3B 57 0A D0 9F 82 BF AD C2 90 00          ...;W.........
Status: No Error
cm>  ext-auth plain
 => 84 82 00 00 10 EA 1A 9D A0 24 E6 00 9E F8 84 96    .........$......
    1A 77 71 46 B4                                     .wqF.
 (56879 usec)
 <= 90 00                                              ..
Status: No Error
cm>  delete ff4563686f4170706c6574
 => 80 E4 00 00 0D 4F 0B FF 45 63 68 6F 41 70 70 6C    .....O..EchoAppl
    65 74 00                                           et.
 (956894 usec)
 <= 00 90 00                                           ...
Status: No Error

As you don't want to perform all the cryptographic protocol by yourself there are tools out there, that do the job for you. 由于您不希望自己执行所有加密协议,因此有一些工具可以为您完成工作。 The best freeware tool in my opinion is GlobalPlatformPro from Martin Paljek. 我认为最好的免费软件工具是Martin Paljek的GlobalPlatformPro Beware that there are plenty other tools that might be deprecated. 请注意,还有许多其他工具可能不建议使用。

In order to perform remote application management on SIM you need to have OTA keys of SIM card and OTA platform to construct appropriate GSM 03.48 and 03.40 APDU commands to exchange secure data packets with SIM. 为了在SIM上执行远程应用程序管理,您需要具有SIM卡的OTA密钥和OTA平台,以构造适当的GSM 03.48和03.40 APDU命令以与SIM交换安全数据包。 SIM carries out authentication of mobile user in mobile networks and neither GSM nor OTA keys of SIM cards never shared by mobile operators to 3rd parties. SIM在移动网络中对移动用户进行身份验证,而移动运营商从未与第三方共享SIM卡的GSM或OTA密钥。

MNOs have OTA platform which maintains relational database to keep MSISDN-ICCID-OTA Keys(KiK,KiD and KiC) triplet. MNO具有OTA平台,该平台维护关系数据库以使MSISDN-ICCID-OTA密钥(KiK,KiD和KiC)保持三重态。 Apart from OTA keys, SPI, TAR and CNTR values as part of each SIM card profile is kept in OTA platform to generate GSM 03.48 packet. 除OTA密钥外,作为每个SIM卡配置文件一部分的SPI,TAR和CNTR值都保存在OTA平台中,以生成GSM 03.48数据包。 So to perform any applet provisioning (instal, update delete) generally secure data content must be encrypted with KiC and KiD. 因此,要执行任何小程序设置(安装,更新删除),通常必须使用KiC和KiD对安全数据内容进行加密。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM