workaround for CAPDU's inability to handle le=0000
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
#
|
||||
from virtualsmartcard.TLVutils import pack, unpack, bertlv_pack
|
||||
from virtualsmartcard.ConstantDefinitions import CRT_TEMPLATE, ALGO_MAPPING, \
|
||||
SM_Class
|
||||
SM_Class, MAX_EXTENDED_LE
|
||||
from virtualsmartcard.utils import inttostring, stringtoint, C_APDU
|
||||
from virtualsmartcard.SWutils import SwError, SW
|
||||
import virtualsmartcard.CryptoUtils as vsCrypto
|
||||
@@ -398,7 +398,10 @@ class Security_Environment(object):
|
||||
|
||||
if isinstance(le, str):
|
||||
# FIXME C_APDU only handles le with strings of length 1. Better patch utils.py to support extended length apdus
|
||||
le = stringtoint(le)
|
||||
le_int = stringtoint(le)
|
||||
if le_int == 0 and len(le) > 1:
|
||||
le_int = MAX_EXTENDED_LE
|
||||
le = le_int
|
||||
|
||||
c = C_APDU(cla=cla, ins=ins, p1=p1, p2=p2, le=le, data="".join(return_data))
|
||||
return c
|
||||
|
||||
Reference in New Issue
Block a user