def perform_key_handshake(self, data=None): """Perform a key handshake and initialize crypto keys""" # pylint: disable=unused-argument esn = data or g.get_esn() if not esn: common.info('Cannot perform key handshake, missing ESN') return False common.debug('Performing key handshake. ESN: {}', esn) response = _process_json_response(self._post(ENDPOINTS['manifest'], self.handshake_request(esn))) header_data = self.decrypt_header_data(response['headerdata'], False) self.crypto.parse_key_response(header_data, not common.is_edge_esn(esn)) # Delete all the user id tokens (are correlated to the previous mastertoken) self.crypto.clear_user_id_tokens() common.debug('Key handshake successful') return True
def perform_key_handshake(self, data=None): """Perform a key handshake and initialize crypto keys""" # pylint: disable=unused-argument esn = data or g.get_esn() if not esn: common.info('Cannot perform key handshake, missing ESN') return common.debug('Performing key handshake. ESN: {}'.format(esn)) response = _process_json_response( self._post(ENDPOINTS['manifest'], self.request_builder.handshake_request(esn))) headerdata = json.loads( base64.standard_b64decode(response['headerdata'])) self.request_builder.crypto.parse_key_response( headerdata, not common.is_edge_esn(esn)) common.debug('Key handshake successful')