aboutsummaryrefslogtreecommitdiffstats
path: root/cards
diff options
context:
space:
mode:
authorhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2006-11-15 08:16:35 +0000
committerhploetz <hploetz@f711b948-2313-0410-aaa9-d29f33439f0b>2006-11-15 08:16:35 +0000
commit753f3ef2715db0ca21294a67f3d1eb5b4ca4aa21 (patch)
tree7dc995d15d480395fe5b3d24b72564a6446aeaa5 /cards
parent3bc5f0d3cfb5aa4756f386b81b099ca7d866a842 (diff)
delete command
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@124 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'cards')
-rw-r--r--cards/tcos_card.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/cards/tcos_card.py b/cards/tcos_card.py
index 92701ba..7cd8fc8 100644
--- a/cards/tcos_card.py
+++ b/cards/tcos_card.py
@@ -4,17 +4,12 @@ import building_blocks
class TCOS_Card(ISO_7816_4_Card,building_blocks.Card_with_80_aa):
DRIVER_NAME = "TCOS"
+ APDU_DELETE_FILE = C_APDU("\x80\xe4\x00\x00")
ATRS = [
("3bba96008131865d0064........31809000..", None),
]
- COMMANDS = {
- "list_dirs": building_blocks.Card_with_80_aa.cmd_listdirs,
- "list_files": building_blocks.Card_with_80_aa.cmd_listfiles,
- "ls": building_blocks.Card_with_80_aa.cmd_list,
- }
-
file_status_descriptions = (
(0xF9, 0x01, None, "Not invalidated"),
(0xF9, 0x00, None, "Invalidated"),
@@ -199,6 +194,18 @@ class TCOS_Card(ISO_7816_4_Card,building_blocks.Card_with_80_aa):
return "\n".join(results)
+ def delete_file(self, fid):
+ result = self.send_apdu(
+ C_APDU(self.APDU_DELETE_FILE, data = fid)
+ )
+ return result
+
+ def cmd_delete(self, file):
+ "Delete a file"
+ fid = binascii.a2b_hex("".join(file.split()))
+
+ self.delete_file(fid)
+
TLV_OBJECTS = {
TLV_utils.context_FCP: {
0x86: (decode_security_attributes, "Security attributes"),
@@ -206,3 +213,11 @@ class TCOS_Card(ISO_7816_4_Card,building_blocks.Card_with_80_aa):
},
}
TLV_OBJECTS[TLV_utils.context_FCI] = TLV_OBJECTS[TLV_utils.context_FCP]
+
+ COMMANDS = {
+ "list_dirs": building_blocks.Card_with_80_aa.cmd_listdirs,
+ "list_files": building_blocks.Card_with_80_aa.cmd_listfiles,
+ "ls": building_blocks.Card_with_80_aa.cmd_list,
+ "delete": cmd_delete,
+ }
+