Ejemplo n.º 1
0
 def formatResult(self, seekable, le, data, sw, sm):
     r = R_APDU(Iso7816OS.formatResult(self, seekable, le, data, sw, sm))
     # The Belpic applet provides a bogus file length of 65536 for
     # every file, and does not return an error or warning when the
     # actual file length is shorter that the file as found; so
     # filter out the EOFBEFORENEREAD warning
     if (r.sw1 == 0x62 and r.sw2 == 0x82):
         logging.info("Filtering out warning")
         r.sw = "9000".decode("hex")
     return r.render()
Ejemplo n.º 2
0
    def formatResult(self, ins, le, data, sw):
        if le == 0 and len(data):
            # cryptoflex does not inpterpret le==0 as maxle
            self.lastCommandSW = sw
            self.lastCommandOffcut = data
            r = R_APDU(inttostring(SW["ERR_WRONGLENGTH"] +\
                    min(0xff, len(data)))).render()
        else:
            if ins == 0xa4 and len(data):
                # get response should be followed by select file
                self.lastCommandSW = sw
                self.lastCommandOffcut = data
                r = R_APDU(inttostring(SW["NORMAL_REST"] +\
                    min(0xff, len(data)))).render()
            else:
                r = Iso7816OS.formatResult(self, Iso7816OS.seekable(ins), le, data, sw, False)

        return r