I have a Gemalto Top DL v2 java card. When I list
the contents, there are a lot of packages loaded in the card:
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -list
AID: A000000018434D00 (|.....CM.|)
ISD OP_READY: Security Domain, Card lock, Card terminate, Default selected, CVM (PIN) management
AID: A0000000620001 (|....b..|)
ExM LOADED: (none)
AID: A0000000620002 (|....b..|)
ExM LOADED: (none)
AID: A0000000620003 (|....b..|)
ExM LOADED: (none)
AID: A0000000620101 (|....b..|)
ExM LOADED: (none)
AID: A000000062010101 (|....b...|)
ExM LOADED: (none)
AID: A0000000620102 (|....b..|)
ExM LOADED: (none)
AID: A0000000620201 (|....b..|)
ExM LOADED: (none)
AID: A0000000030000 (|.......|)
ExM LOADED: (none)
AID: A000000018100201 (|........|)
ExM LOADED: (none)
AID: A000000018100101 (|........|)
ExM LOADED: (none)
A000000018534441 (|.....SDA|)
AID: A00000015100 (|....Q.|)
ExM LOADED: (none)
Now, I want to delete unused packages:
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A0000000620001 -deletedeps
Could not delete AID: A0000000620001
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A0000000620002 -deletedeps
Could not delete AID: A0000000620002
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A0000000620003 -deletedeps
Could not delete AID: A0000000620003
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A0000000620101 -deletedeps
Could not delete AID: A0000000620101
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A000000062010101 -deletedeps
Could not delete AID: A000000062010101
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A0000000620102 -deletedeps
Could not delete AID: A0000000620102
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A0000000620201 -deletedeps
Could not delete AID: A0000000620201
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A0000000030000 -deletedeps
Could not delete AID: A0000000030000
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A000000018100201 -deletedeps
Could not delete AID: A000000018100201
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A000000018100101 -deletedeps
Could not delete AID: A000000018100101
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
GlobalPlatformPro:> gp -visa2 -key 47454D5850524553534F53414D504C45 -delete A00000015100 -deletedeps
Could not delete AID: A00000015100
TIP: Maybe try with --deletedeps
openkms.gp.GPException: Deletion failed SW: 6985
at openkms.gp.GlobalPlatform.check(GlobalPlatform.java:1039)
at openkms.gp.GlobalPlatform.deleteAID(GlobalPlatform.java:814)
at openkms.gp.GPTool.main(GPTool.java:367)
The question is Why I can't delete them and free my card's memory?
How are you sure that these packages are unused? An applet could have been designed to use separate libraries and / or services. These libraries / services have their own AID within GP, but you'd first need to delete all the applet instances and applet modules - in that order - before you can remove them.
A lot of cards contain pre-installed software in ROM. The space in the ROM mask cannot be reused for anything else. Deleting these modules won't free up many resources. If the deletion succeeds you would basically only have removed the AID from a registry. This can be useful if you want to upload a new version of the same library, but otherwise it won't make much of a difference.
AID's consist of two parts: a 5 byte RID and a variable sized extension - called PIX - to the RID identifying the entity. This entity is in just the application DF, but for Java Card modules are also identified by AID.
Now I've procured a list of RID's so:
A000000018434D00
the security domain is from Gemplus (now Gemalto);A0000000620001
, A0000000620002
, A0000000620003
, A0000000620101
, A000000062010101
, A0000000620102
, A0000000620201
are all Sun (now Oracle) modules; they contain extensions to the basic Java Card runtime;A0000000030000
is the card manager under the old VISA RID;A000000018100201
, A000000018100101
are extension modules or applets from Gemalto;A00000015100
is the card manager under the Global Platform AID;The A0000000030000
AID is being phased out - VISA was a founder of Open Platform, now Global Platform. GP is now supposed to use their own RID.