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):
|
||||
"""Base class for a smart card OS"""
|
||||
|
||||
mf = make_property("mf", "master file")
|
||||
SAM = make_property("SAM", "secure access module")
|
||||
|
||||
def getATR(self):
|
||||
"""Returns the ATR of the card as string of characters"""
|
||||
return ""
|
||||
|
||||
def powerUp(self):
|
||||
"""Powers up the card"""
|
||||
self.mf.current = self.mf
|
||||
pass
|
||||
|
||||
def powerDown(self):
|
||||
@@ -47,7 +43,6 @@ class SmartcardOS(object):
|
||||
|
||||
def reset(self):
|
||||
"""Performs a warm reset of the card (no power down)"""
|
||||
self.mf.current = self.mf
|
||||
pass
|
||||
|
||||
def execute(self, msg):
|
||||
@@ -59,6 +54,10 @@ class SmartcardOS(object):
|
||||
|
||||
|
||||
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):
|
||||
self.mf = mf
|
||||
self.SAM = sam
|
||||
@@ -349,6 +348,12 @@ class Iso7816OS(SmartcardOS):
|
||||
|
||||
return answer
|
||||
|
||||
def powerUp(self):
|
||||
self.mf.current = self.mf
|
||||
|
||||
def reset(self):
|
||||
self.mf.current = self.mf
|
||||
|
||||
|
||||
|
||||
# sizeof(int) taken from asizof-package {{{
|
||||
|
||||
@@ -33,12 +33,6 @@ class HandlerTestOS(SmartcardOS):
|
||||
|
||||
def getATR(self):
|
||||
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):
|
||||
le = (ord(msg[2])<<8)+ord(msg[3])
|
||||
|
||||
Reference in New Issue
Block a user