gpt4 book ai didi

smartcard - 无法删除小程序

转载 作者:行者123 更新时间:2023-12-05 09:22:48 25 4
gpt4 key购买 nike

我创建了一个 .cap 文件,代码是 here .这是一个简单的一次性密码生成器。

最后我将 010203040506070809 设置为 package ID 并将 0102030405060708090000 设置为 applet AID,并将其上传到我的卡中.

这是列出小程序时 GPJ 的输出:

C:\Users\ghasemi\Desktop\gpj-20120310>gpj -list

C:\Users\ghasemi\Desktop\gpj-20120310>java -jar gpj.jar -list
Found terminals: [PC/SC terminal ACS CCID USB Reader 0]
Found card in terminal: ACS CCID USB Reader 0
ATR: 3B 68 00 00 00 73 C8 40 12 00 90 00
DEBUG: Command APDU: 00 A4 04 00 07 A0 00 00 01 51 00 00
DEBUG: Response APDU: 6A 82
Failed to select Security Domain GP211 A0 00 00 01 51 00 00 , SW: 6A 82
DEBUG: Command APDU: 00 A4 04 00 08 A0 00 00 00 18 43 4D 00
DEBUG: Response APDU: 6A 82
Failed to select Security Domain GemaltoXpressPro A0 00 00 00 18 43 4D 00 , SW:
6A 82
DEBUG: Command APDU: 00 A4 04 00 08 A0 00 00 00 03 00 00 00
DEBUG: Response APDU: 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 01 FF 90 0
0
Successfully selected Security Domain OP201a A0 00 00 00 03 00 00 00
DEBUG: Command APDU: 80 50 00 00 08 B5 16 68 A9 92 84 7D 58
DEBUG: Response APDU: 00 00 11 60 01 00 8A 79 0A F9 FF 02 00 5B 6B 9E 48 44 A2 D
B 8A 52 C1 87 99 FC 26 72 90 00
DEBUG: Command APDU: 84 82 00 00 10 EE 5D DB 8D 26 DA C6 B9 51 85 E1 33 A2 CE 2
4 AD
DEBUG: Response APDU: 90 00
DEBUG: Command APDU: 84 82 00 00 08 EE 5D DB 8D 26 DA C6 B9
DEBUG: Response APDU: 90 00
DEBUG: Command APDU: 80 F2 80 00 02 4F 00
DEBUG: Response APDU: 08 A0 00 00 00 03 00 00 00 01 9E 90 00
DEBUG: Command APDU: 80 F2 80 00 02 4F 00
DEBUG: Response APDU: 08 A0 00 00 00 03 00 00 00 01 9E 90 00
DEBUG: Command APDU: 80 F2 40 00 02 4F 00
DEBUG: Response APDU: 0B 01 02 03 04 05 06 07 08 09 00 00 07 00 90 00
DEBUG: Command APDU: 80 F2 40 00 02 4F 00
DEBUG: Response APDU: 0B 01 02 03 04 05 06 07 08 09 00 00 07 00 90 00
DEBUG: Command APDU: 80 F2 10 00 02 4F 00
DEBUG: Response APDU: 6A 81
DEBUG: Command APDU: 80 F2 10 00 02 4F 00
DEBUG: Response APDU: 6A 81
DEBUG: Command APDU: 80 F2 20 00 02 4F 00
DEBUG: Response APDU: 0A 01 02 03 04 05 06 07 08 09 00 01 00 90 00
DEBUG: Command APDU: 80 F2 20 00 02 4F 00
DEBUG: Response APDU: 0A 01 02 03 04 05 06 07 08 09 00 01 00 90 00
AID: A0 00 00 00 03 00 00 00 |........| ISD LC: 1 P
R: 0x9E

AID: 01 02 03 04 05 06 07 08 09 00 00 |...........| App LC: 7 P
R: 0x00

AID: 01 02 03 04 05 06 07 08 09 00 |..........| Exe LC: 1 P
R: 0x00

C:\Users\ghasemi\Desktop\gpj-20120310>

如您所见,我的小程序已成功上传。


上传后我将一些 APDU 发送到我的小程序:

< 00 A4 04 00 0B 00
< 01 02 03 04 05 06 07 08 09 00 00
> 9000

< 00 20 00 02 03 00
< 22 22 22
> 9000

< 00 20 00 02 03 00
< 11 11 23
> 6C02

< 00 20 00 02 03 00
< 11 11 23
> 6C01

< 00 20 00 02 03 00
< 11 11 23
> 6C00

< 00 20 00 02 03 00
< 11 11 23
> 6D00

正如您在上面看到的,我选择了我的小程序,向它发送验证命令(一次使用正确的 PIN,三次使用错误的 PIN)。并锁定它。


现在我要删除小程序:

C:\Users\ghasemi\Desktop\gpj-20120310>java -jar gpj.jar -delete 0102030405060708
090000 -deletedeps
Found terminals: [PC/SC terminal ACS CCID USB Reader 0]
Found card in terminal: ACS CCID USB Reader 0
ATR: 3B 68 00 00 00 73 C8 40 12 00 90 00
DEBUG: Command APDU: 00 A4 04 00 07 A0 00 00 01 51 00 00
DEBUG: Response APDU: 6A 82
Failed to select Security Domain GP211 A0 00 00 01 51 00 00 , SW: 6A 82
DEBUG: Command APDU: 00 A4 04 00 08 A0 00 00 00 18 43 4D 00
DEBUG: Response APDU: 6A 82
Failed to select Security Domain GemaltoXpressPro A0 00 00 00 18 43 4D 00 , SW:
6A 82
DEBUG: Command APDU: 00 A4 04 00 08 A0 00 00 00 03 00 00 00
DEBUG: Response APDU: 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 01 FF 90 0
0
Successfully selected Security Domain OP201a A0 00 00 00 03 00 00 00
DEBUG: Command APDU: 80 50 00 00 08 5E 64 FF F5 A9 52 96 4D
DEBUG: Response APDU: 00 00 11 60 01 00 8A 79 0A F9 FF 02 00 5A 29 D0 38 18 61 9
9 BA 72 91 2D 89 12 55 0E 90 00
DEBUG: Command APDU: 84 82 00 00 10 20 3E 1D 85 1C 36 2B B8 EA DC 25 E9 9F 78 8
D 2D
DEBUG: Response APDU: 90 00
DEBUG: Command APDU: 84 82 00 00 08 20 3E 1D 85 1C 36 2B B8
DEBUG: Response APDU: 90 00
DEBUG: Command APDU: 80 E4 00 80 0D 4F 0B 01 02 03 04 05 06 07 08 09 00 00
DEBUG: Response APDU: 6A 86
DEBUG: Command APDU: 80 E4 00 80 0D 4F 0B 01 02 03 04 05 06 07 08 09 00 00
DEBUG: Response APDU: 6A 86
Could not delete AID: 01 02 03 04 05 06 07 08 09 00 00

C:\Users\ghasemi\Desktop\gpj-20120310>

Q1:是我屏蔽了卡还是只是屏蔽了我的小程序?

Q2:为什么删除不了,怎么办?

最佳答案

您需要删除整个可执行加载文件(应用程序包)及其所有相关对象(应用程序实例):

gpj -deletedeps -delete 01020304050607080900

原因是您的小程序类 (TANGen) 包含几个引用由您的小程序创建的对象的静态字段:

static byte[]        scid;
static byte[] workarray;
static byte[] seed;
static DESKey tangenkey;
static Signature mac;
static OwnerPIN adminpin;
static OwnerPIN userpin;

这些对象是在 applet 实例(应用程序)的上下文中创建的,但可以从整个应用程序包中访问(因此与应用程序包而不是 applet 实例相关联)。因此,仅删除应用程序会破坏这些引用。因此,它们会阻止您的应用程序实例被删除,您只能通过删除整个应用程序包(可执行加载文件)及其所有关联对象来删除它。

关于smartcard - 无法删除小程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24594672/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com