From 8c1694f5b4c432115271d0f7fce4623285832307 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Tue, 9 Jul 2013 07:10:18 +0200 Subject: [PATCH] raise a SW error on failed decryption --- virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py b/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py index 6b6479f..d35424c 100644 --- a/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py +++ b/virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py @@ -337,7 +337,10 @@ class SAM(object): Parse a command APDU protected by Secure Messaging and return the unprotected command APDU """ - return self.current_SE.parse_SM_CAPDU(CAPDU, header_authentication) + try: + return self.current_SE.parse_SM_CAPDU(CAPDU, header_authentication) + except: + raise SwError(SW["ERR_SECMESSOBJECTSINCORRECT"]) def protect_result(self, sw, unprotected_result): """