From e30640e43dcef56b4c29b105b7e7eb36d83bb198 Mon Sep 17 00:00:00 2001 From: frankmorgner Date: Sun, 10 Jan 2010 22:53:34 +0000 Subject: [PATCH] bugfix git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@15 96b47cad-a561-4643-ad3b-153ac7d7599c --- virtualsmartcard/vpicc/VirtualSmartcard.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/virtualsmartcard/vpicc/VirtualSmartcard.py b/virtualsmartcard/vpicc/VirtualSmartcard.py index 929471f..ecb8959 100644 --- a/virtualsmartcard/vpicc/VirtualSmartcard.py +++ b/virtualsmartcard/vpicc/VirtualSmartcard.py @@ -280,7 +280,11 @@ class SmartcardOS(object): # {{{ def notImplemented(*argz, **args): raise SwError(SW["ERR_INSNOTSUPPORTED"]) - c = C_APDU(msg) + try: + c = C_APDU(msg) + except ValueError, e: + print e + return self.formatResult(0, 0, "", SW["ERR_INCORRECTPARAMETERS"]) #Handle Class Byte{{{ class_byte = c.cla @@ -429,7 +433,12 @@ class CryptoflexOS(SmartcardOS): # {{{ def notImplemented(*argz, **args): raise SwError(SW["ERR_INSNOTSUPPORTED"]) - c = C_APDU(msg) + try: + c = C_APDU(msg) + except ValueError, e: + print e + return self.formatResult(0, 0, "", SW["ERR_INCORRECTPARAMETERS"]) + try: sw, result = self.ins2handler.get(c.ins, notImplemented)(c.p1, c.p2, c.data) #print type(result)