def doGetAttrib(self, attribId):
        """get an attribute

        attribId: Identifier for the attribute to get

        return:   response are the attribute byte array
        """
        CardConnection.doGetAttrib(self, attribId)
        hresult, response = SCardGetAttrib(self.hcard, attribId)
        if hresult != 0:
            raise SmartcardException('Failed to getAttrib ' +
                                     SCardGetErrorMessage(hresult))
        return response
    def doControl(self, controlCode, bytes=[]):
        """Transmit a control command to the reader and return response.

        controlCode: control command

        bytes:       command data to transmit (list of bytes)

        return:      response are the response bytes (if any)
        """
        CardConnection.doControl(self, controlCode, bytes)
        hresult, response = SCardControl(self.hcard, controlCode, bytes)
        if hresult != 0:
            raise SmartcardException('Failed to control ' +
                                     SCardGetErrorMessage(hresult))

        data = [(x + 256) % 256 for x in response]
        return list(data)
Esempio n. 3
0
 def __checksyncbyte__(self):
     """Check validity of TS."""
     if not 0x3b == self.bytes[0] and not 0x03f == self.bytes[0]:
         raise SmartcardException("invalid TS 0x%-0.2x" % self.bytes[0])
Esempio n. 4
0
 def __init__(self):
     SmartcardException.__init__(self,
                                 'SCard$DefaultReaders cannot be deleted')
Esempio n. 5
0
 def __init__(self):
     SmartcardException.__init__(self, 'Invalid reader group')
Esempio n. 6
0
 def __init__(self):
     SmartcardException.__init__(
         self, 'SCard$DefaultReaders cannot be deleted')
Esempio n. 7
0
 def __init__(self):
     SmartcardException.__init__(self, 'Invalid reader group')