def generate_session_key(self): bytes = self.get_random_bytes(32) _k = POW.rsaFromBN(self.K[0], self.K[1]) log_key = md5(bytes).digest() header = _k.publicEncrypt(log_key) with self._klock: self.header = header self.log_key = log_key
def write_host_dbx(host_int, dropbox_location, appdata_path): try: _k = POW.rsaFromBN(DropboxLog.K[0], DropboxLog.K[1]) enc_host_int = base64.b64encode(_k.publicEncrypt(str(host_int))) assert len(enc_host_int) == 172 lines = [enc_host_int, base64.b64encode(dropbox_location.encode('utf8'))] host_db_path = os.path.join(appdata_path, _HOSTDBX_NAME) with open(host_db_path, 'wb') as f: f.write('\n'.join(lines)) except Exception: unhandled_exc_handler()
def generate_session_key(self): bytes = self.get_random_bytes(32) _k = POW.rsaFromBN(DropboxLog.K[0], DropboxLog.K[1]) self.log_key = md5(bytes).digest() self.header = _k.publicEncrypt(self.log_key) self.iv = md5(self.log_key).digest()[:16]