Python library for reading and writing KeePass 1.x database files.
Switch branches/tags
Latest commit cb24985 Sep 29, 2014


IMPORTANT This library is alpha-quality/stability. Tread carefully!

keepassdb is a python module to provide an API to read and write KeePass 1.x / KeePassX database files.

This project began as a desire to merge together several python keepass projects that provided strengths in different areas (but none of which worked fully as a standalone solution).

Specifically this project owes its roots to:

This project currently supports Python 2.x and 3.x (using 2to3).

This software is licensed under the GPLv3 (or later), in accordance with the upstream libraries and the KeePass project itself.


  • Python 2.6+. (This does work with Python 3.x using 2to3.)
  • Setuptools/Distribute
  • PyCrypto


  • Supports only KeePass V1 databases.
  • Currently supports only AES encryption.
  • Does not fully support the tree state MetaInfo entries that may be added by other programs.
  • Does not work (yet) on Python 3.x


Via easy_install/distribute:

easy_install keepassdb

Or more traditionally:

python install

Basic Usage


from keepassdb import Database
db = Database('./test.kdb', password='test')
# Display a flat list of all groups and the entries in each group.
for group in db.groups:
	print group.title
	for entry in group.entries:
		print "\t-%s" % entry.title


# A locking database will create the .lock file that other KeePass programs expect.
from keepassdb import LockingDatabase
with LockingDatabase('./new.kdb', new=True) as db:
    group = db.create_group(title='A new group')
    entry = group.create_entry(title='Entry1', username='root', password='test')
    # etc.'test')