def _read_capabilities(self): data = '\0' resp = self._sendrecv(U2FHID_YK4_CAPABILITIES, data) self._cap_data = parse_tlv_list(resp[1:ord(resp[0]) + 1]) self._cap = int(self._cap_data.get(YK4_CAPA_TAG, '0').encode('hex'), 16) self.allowed_modes = ( bool(self._cap & YK4_CAPA1_OTP), bool(self._cap & YK4_CAPA1_CCID), bool(self._cap & YK4_CAPA1_U2F) )
def _read_capabilities(self): buf_size = c_size_t(1024) resp = create_string_buffer(buf_size.value) yk_get_capabilities(self._dev, 0, 0, resp, byref(buf_size)) resp = resp.raw self._cap_data = parse_tlv_list(resp[1:ord(resp[0]) + 1]) self._cap = int( self._cap_data.get(YK4_CAPA_TAG, '0').encode('hex'), 16) self.allowed_modes = (bool(self._cap & YK4_CAPA1_OTP), bool(self._cap & YK4_CAPA1_CCID), bool(self._cap & YK4_CAPA1_U2F))
def _read_capabilities(self): buf_size = c_size_t(1024) resp = create_string_buffer(buf_size.value) yk_get_capabilities(self._dev, 0, 0, resp, byref(buf_size)) resp = resp.raw self._cap_data = parse_tlv_list(resp[1:ord(resp[0]) + 1]) self._cap = int(self._cap_data.get(YK4_CAPA_TAG, '0').encode('hex'), 16) self.allowed_modes = ( bool(self._cap & YK4_CAPA1_OTP), bool(self._cap & YK4_CAPA1_CCID), bool(self._cap & YK4_CAPA1_U2F) )
def _read_capabilities(self): self.send_apdu(YK4_SELECT_MGMT) resp = self.send_apdu(YK4_GET_CAPA) resp, status = resp[:-2], resp[-2:] if status != '\x90\x00': resp = '\x00' if self.version == (4, 2, 4): # 4.2.4 has a bug with capabilities. resp = '0301013f'.decode('hex') self._cap_data = parse_tlv_list(resp[1:ord(resp[0]) + 1]) self._cap = int( self._cap_data.get(YK4_CAPA_TAG, '0').encode('hex'), 16) self.allowed_modes = (bool(self._cap & YK4_CAPA1_OTP), bool(self._cap & YK4_CAPA1_CCID), bool(self._cap & YK4_CAPA1_U2F))
def _read_capabilities(self): self.send_apdu(YK4_SELECT_MGMT) resp = self.send_apdu(YK4_GET_CAPA) resp, status = resp[:-2], resp[-2:] if status != '\x90\x00': resp = '\x00' if self.version == (4, 2, 4): # 4.2.4 has a bug with capabilities. resp = '0301013f'.decode('hex') self._cap_data = parse_tlv_list(resp[1:ord(resp[0]) + 1]) self._cap = int(self._cap_data.get(YK4_CAPA_TAG, '0').encode('hex'), 16) self.allowed_modes = ( bool(self._cap & YK4_CAPA1_OTP), bool(self._cap & YK4_CAPA1_CCID), bool(self._cap & YK4_CAPA1_U2F) )