aboutsummaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorhenryk <henryk@f711b948-2313-0410-aaa9-d29f33439f0b>2005-09-30 03:03:54 +0000
committerhenryk <henryk@f711b948-2313-0410-aaa9-d29f33439f0b>2005-09-30 03:03:54 +0000
commitb89286679ba48cef0bd3b0dc1111176df7c871b5 (patch)
tree88c63a576708a3d7274d95fda1bf7188f4748506 /utils.py
parent28021747f45a57931bbda175d937a58881677c93 (diff)
lc calculation
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@24 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/utils.py b/utils.py
index 84f3dfa..98e5823 100644
--- a/utils.py
+++ b/utils.py
@@ -124,7 +124,6 @@ class APDU(list):
if len(self) < 4:
self.extend([0] * (4-len(self)))
- print self
le = None
for (kw, arg) in kwargs.items():
if kw == "cla":
@@ -146,13 +145,15 @@ class APDU(list):
else:
raise TypeError, "Got an unexpected keyword argument '%s'" % kw
- print self
if le is not None:
if len(self) > self.OFFSET_CONTENT:
raise TypeError, "le can't be set when there is data to send"
else:
self[self.OFFSET_LE:self.OFFSET_LE+1] = (le,)
+ if self[self.OFFSET_LC] == None:
+ self[self.OFFSET_LC] = len(self)-self.OFFSET_CONTENT
+
for i in range(len(self)):
t = type(self[i])
if t == str:
@@ -240,6 +241,6 @@ if __name__ == "__main__":
#response = sys.stdin.read()
#parse_status(_unformat_hexdump(response)[:-2])
- print APDU((1,2,3), lc=42, cla=0x23, le=4)
+ print APDU((1,2,3), cla=0x23, content="hallo", lc=None)