Let SmartcardOS have only stubs
mf and SAM are implementations pecific to Iso7816OS
This commit is contained in:
@@ -29,16 +29,12 @@ import socket, struct, sys, signal, atexit, logging
|
|||||||
class SmartcardOS(object):
|
class SmartcardOS(object):
|
||||||
"""Base class for a smart card OS"""
|
"""Base class for a smart card OS"""
|
||||||
|
|
||||||
mf = make_property("mf", "master file")
|
|
||||||
SAM = make_property("SAM", "secure access module")
|
|
||||||
|
|
||||||
def getATR(self):
|
def getATR(self):
|
||||||
"""Returns the ATR of the card as string of characters"""
|
"""Returns the ATR of the card as string of characters"""
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def powerUp(self):
|
def powerUp(self):
|
||||||
"""Powers up the card"""
|
"""Powers up the card"""
|
||||||
self.mf.current = self.mf
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def powerDown(self):
|
def powerDown(self):
|
||||||
@@ -47,7 +43,6 @@ class SmartcardOS(object):
|
|||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
"""Performs a warm reset of the card (no power down)"""
|
"""Performs a warm reset of the card (no power down)"""
|
||||||
self.mf.current = self.mf
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def execute(self, msg):
|
def execute(self, msg):
|
||||||
@@ -59,6 +54,10 @@ class SmartcardOS(object):
|
|||||||
|
|
||||||
|
|
||||||
class Iso7816OS(SmartcardOS):
|
class Iso7816OS(SmartcardOS):
|
||||||
|
|
||||||
|
mf = make_property("mf", "master file")
|
||||||
|
SAM = make_property("SAM", "secure access module")
|
||||||
|
|
||||||
def __init__(self, mf, sam, ins2handler=None, extended_length=False):
|
def __init__(self, mf, sam, ins2handler=None, extended_length=False):
|
||||||
self.mf = mf
|
self.mf = mf
|
||||||
self.SAM = sam
|
self.SAM = sam
|
||||||
@@ -349,6 +348,12 @@ class Iso7816OS(SmartcardOS):
|
|||||||
|
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
|
def powerUp(self):
|
||||||
|
self.mf.current = self.mf
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
self.mf.current = self.mf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# sizeof(int) taken from asizof-package {{{
|
# sizeof(int) taken from asizof-package {{{
|
||||||
|
|||||||
@@ -34,12 +34,6 @@ class HandlerTestOS(SmartcardOS):
|
|||||||
def getATR(self):
|
def getATR(self):
|
||||||
return '\x3B\xD6\x18\x00\x80\xB1\x80\x6D\x1F\x03\x80\x51\x00\x61\x10\x30\x9E'
|
return '\x3B\xD6\x18\x00\x80\xB1\x80\x6D\x1F\x03\x80\x51\x00\x61\x10\x30\x9E'
|
||||||
|
|
||||||
def powerUp(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def reset(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __output_from_le(self, msg):
|
def __output_from_le(self, msg):
|
||||||
le = (ord(msg[2])<<8)+ord(msg[3])
|
le = (ord(msg[2])<<8)+ord(msg[3])
|
||||||
return ''.join([chr(num&0xff) for num in xrange(le)])
|
return ''.join([chr(num&0xff) for num in xrange(le)])
|
||||||
|
|||||||
Reference in New Issue
Block a user