def export_recovery_key(self): self.show_selected_grid_view() gateway = self.current_view().gateway password, ok = PasswordDialog.get_password( self, "Encryption passphrase (optional):") if ok and password: self.export_encrypted_recovery(gateway, password) elif ok: self.export_plaintext_recovery(gateway)
def do_export(self, gateway): password, ok = PasswordDialog.get_password( self.parent, "Encryption passphrase (optional):", "A long passphrase will help keep your files safe in the event " "that your Recovery Key is ever compromised.") if ok and password: self._export_encrypted_recovery(gateway, password) elif ok: self._export_plaintext_recovery(gateway)
def export_recovery_key(self, gateway=None): self.show_selected_grid_view() if not gateway: gateway = self.current_view().gateway password, ok = PasswordDialog.get_password( self, "Encryption passphrase (optional):", "A long passphrase will help keep your files safe in the event " "that your Recovery Key is ever compromised.") if ok and password: self.export_encrypted_recovery(gateway, password) elif ok: self.export_plaintext_recovery(gateway)
def parse_content(self, content): try: settings = json.loads(content.decode('utf-8')) except (UnicodeDecodeError, json.decoder.JSONDecodeError): password, ok = PasswordDialog.get_password( self, "Decryption passphrase (required):", "This Recovery Key is protected by a passphrase. Enter the " "correct passphrase to decrypt it.", show_stats=False) if ok: self.decrypt_content(content, password) return self.load_settings(settings)
def _parse_content(self, content): try: settings = json.loads(content.decode('utf-8')) except (UnicodeDecodeError, json.decoder.JSONDecodeError): logging.debug("JSON decoding failed; %s is likely encrypted", self.filepath) password, ok = PasswordDialog.get_password( self.parent, "Decryption passphrase (required):", "This Recovery Key is protected by a passphrase. Enter the " "correct passphrase to decrypt it.", show_stats=False) if ok: self._decrypt_content(content, password) return self.done.emit(settings)