How to use the pykeepass.exceptions.CredentialsIntegrityError function in pykeepass

To help you get started, we’ve selected a few pykeepass examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github libkeepass / pykeepass / tests / tests.py View on Github external
def test_open_error(self):
        with self.assertRaises(CredentialsIntegrityError):
            database = 'test4.kdbx'
            invalid_password = 'foobar'
            keyfile = os.path.join(base_dir, 'test4.key')
            PyKeePass(
                os.path.join(base_dir, database),
                password=invalid_password,
                keyfile=keyfile
            )
        with self.assertRaises(CredentialsIntegrityError):
            database = 'test4.kdbx'
            password = 'password'
            invalid_keyfile = os.path.join(base_dir, 'test3.key')
            PyKeePass(
                os.path.join(base_dir, database),
                password=password,
                keyfile=invalid_keyfile
            )
github libkeepass / pykeepass / tests / tests.py View on Github external
def test_open_error(self):
        with self.assertRaises(CredentialsIntegrityError):
            database = 'test4.kdbx'
            invalid_password = 'foobar'
            keyfile = os.path.join(base_dir, 'test4.key')
            PyKeePass(
                os.path.join(base_dir, database),
                password=invalid_password,
                keyfile=keyfile
            )
        with self.assertRaises(CredentialsIntegrityError):
            database = 'test4.kdbx'
            password = 'password'
            invalid_keyfile = os.path.join(base_dir, 'test3.key')
            PyKeePass(
                os.path.join(base_dir, database),
                password=password,
                keyfile=invalid_keyfile
github roddhjav / pass-import / pass_import.py View on Github external
Will ask for a password to unlock the data first. Support binary
        attachments.

        :param str path: Path to the KDBX file to parse.

        """
        try:
            from pykeepass import PyKeePass
            from pykeepass.exceptions import CredentialsIntegrityError
        except ImportError as error:
            raise ImportError(error, name='pykeepass')

        password = getpassword(path)
        try:
            keepass = PyKeePass(path, password=password)
        except CredentialsIntegrityError as error:  # pragma: no cover
            raise PermissionError(error)

        for kpentry in keepass.entries:
            entry = self._getentry(kpentry)
            entry['group'] = os.path.dirname(entry['group'])

            for hentry in kpentry.history:
                history = self._getentry(hentry)
                history['group'] = os.path.join('History', entry['group'])
                self.data.append(history)

            for att in kpentry.attachments:
                attachment = dict()
                attachment['group'] = entry['group']
                attachment['title'] = att.filename
                attachment['data'] = att.data
github FalkAlexander / PasswordSafe / passwordsafe / unlock_database.py View on Github external
def composite_unlock_process(self):
        try:
            self.database_manager = DatabaseManager(self.database_filepath, password=self.password_composite, keyfile=self.composite_keyfile_path, logging_manager=self.window.logging_manager)
            GLib.idle_add(self.composite_unlock_success)
        except(OSError, IndexError, ValueError, AttributeError, core.ChecksumError, CredentialsIntegrityError):
            GLib.idle_add(self.composite_unlock_failure)