{"id":13722028,"url":"https://github.com/cternes/openkeepass","last_synced_at":"2025-05-07T14:31:01.249Z","repository":{"id":23623782,"uuid":"26993319","full_name":"cternes/openkeepass","owner":"cternes","description":"[Deprecated] A java library for reading and writing KeePass databases. It is an intuitive java library that supports KeePass 2.x database files.","archived":false,"fork":false,"pushed_at":"2020-10-13T02:14:57.000Z","size":990,"stargazers_count":134,"open_issues_count":10,"forks_count":38,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-11-14T11:39:47.336Z","etag":null,"topics":["android","java","java-library","keepass","keepass-database"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cternes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-22T08:28:29.000Z","updated_at":"2024-10-30T02:17:58.000Z","dependencies_parsed_at":"2022-08-22T02:31:21.902Z","dependency_job_id":null,"html_url":"https://github.com/cternes/openkeepass","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cternes%2Fopenkeepass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cternes%2Fopenkeepass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cternes%2Fopenkeepass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cternes%2Fopenkeepass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cternes","download_url":"https://codeload.github.com/cternes/openkeepass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252895540,"owners_count":21821179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","java","java-library","keepass","keepass-database"],"created_at":"2024-08-03T01:01:23.828Z","updated_at":"2025-05-07T14:31:00.125Z","avatar_url":"https://github.com/cternes.png","language":"Java","readme":"# **DEPRECATED** - unfortunately no longer actively maintained, because I don't have time\r\n\r\n[![Build Status](https://travis-ci.org/cternes/openkeepass.svg?branch=master)](https://travis-ci.org/cternes/openkeepass)\r\n\r\nopenkeepass\r\n===========\r\n\r\nopenkeepass is a java library for reading and writing KeePass databases. It is an intuitive java library that supports **KeePass 2.x database files**.  \r\n\r\n*Only KeePass files created with version 2.x are supported. KeePass files created with version 1.x are NOT supported.* \r\n\r\nFeatures included so far:\r\n\r\n- Reading and writing support for KeePass 2.x\r\n- Password or Keyfile credentials: openkeepass can open password protected databases as well as keyfile protected databases.\r\n- Android Support: Will run on Android devices.\r\n- Easy to learn API: openkeepass has a simple API with convenient methods that makes it easy to read data from a KeePass database.\r\n- Very lean: openkeepass tries to keep the necessary dependencies to an absolute minimum.\r\n- Backward compatible until Java 6\r\n\r\nInstallation\r\n=============\r\n\r\nThe easiest way is to add openkeepass as a maven dependency. \r\n\r\n\t\u003cdependency\u003e\r\n\t    \u003cgroupId\u003ede.slackspace\u003c/groupId\u003e\r\n    \t\u003cartifactId\u003eopenkeepass\u003c/artifactId\u003e\r\n\t    \u003cversion\u003e0.8.1\u003c/version\u003e\r\n\t\u003c/dependency\u003e\r\n\r\nPrerequisites\r\n=============\r\n\r\nBefore using this library make sure that you have the Java Cryptography Extension (JCE) installed on your system. \r\n\r\nYou can download JCE here:\r\n\r\n- [Download JCE for JDK 7](http://www.oracle.com/technetwork/java/embedded/embedded-se/downloads/jce-7-download-432124.html)\r\n- [Download JCE for JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html)\r\n\r\nAndroid\r\n=============\r\n\r\nAndroid users should apply the following dependency to avoid an error regarding build-in xml libraries:\r\n\r\n    compile ('de.slackspace:openkeepass:0.6.0') {\r\n        exclude module: 'stax'\r\n        exclude module: 'stax-api'\r\n        exclude module: 'xpp3'\r\n    }\r\n\r\nExamples for reading\r\n=============\r\n\r\nThe basic usage is very simple. This example will show you how to retrieve all entries and the top groups of the KeePass database.  \r\n\r\n```java\r\n    // Open Database\r\n\tKeePassFile database = KeePassDatabase.getInstance(\"Database.kdbx\").openDatabase(\"MasterPassword\");\r\n\t\t\r\n\t// Retrieve all entries\r\n\tList\u003cEntry\u003e entries = database.getEntries();\r\n\tfor (Entry entry : entries) {\r\n\t\tSystem.out.println(\"Title: \" + entry.getTitle() + \" Password: \" + entry.getPassword());\r\n\t}\r\n\r\n\t// Retrieve all top groups\r\n\tList\u003cGroup\u003e groups = database.getTopGroups();\r\n\tfor (Group group : groups) {\r\n\t\tSystem.out.println(group.getName());\r\n\t}\r\n```\r\n\r\nYou can also search for specific entries in the database:\r\n\r\n```java\r\n\t// Search for single entry\r\n\tEntry sampleEntry = database.getEntryByTitle(\"Sample Entry\");\r\n\tSystem.out.println(\"Title: \" + sampleEntry.getTitle() + \" Password: \" + sampleEntry.getPassword());\r\n\r\n\t// Search for all entries that contain 'Sample' in title\r\n\tList\u003cEntry\u003e entriesByTitle = database.getEntriesByTitle(\"Sample\", false);\r\n\tfor (Entry entry : entriesByTitle) {\r\n\t\tSystem.out.println(\"Title: \" + entry.getTitle() + \" Password: \" + entry.getPassword());\r\n\t}\r\n```\r\n\r\nOpen a database with a key file:\r\n\r\n```java\r\n\t// Open database with keyfile\r\n\tKeePassFile database = KeePassDatabase.getInstance(\"DatabaseProtectedByKeyfile.kdbx\").openDatabase(new File(\"Keyfile.key\"));\r\n\t\t\r\n\t// Print all entries\t\t\r\n\tList\u003cEntry\u003e entries = database.getEntries();\r\n\tfor (Entry entry : entries) {\r\n\t\tSystem.out.println(entry.getTitle() + \":\" + entry.getPassword());\r\n\t}\r\n```\r\n\r\nRetrieve custom string fields (Advanced tab) from a database:\r\n\r\n```java\t\t\r\n\t// Retrieve all properties including custom string fields of an entry\r\n\tSet\u003cProperty\u003e properties = database.getEntryByTitle(\"1st Entry\").getProperties();\r\n\tfor (Property property : properties) {\r\n\t\tSystem.out.println(property.getKey() + \":\" + property.getValue());\r\n\t}\r\n```\r\n\t\r\nFor more usages have a look into the unit test classes.\r\n\t\r\nExamples for writing\r\n=============\r\n\t\r\nIf you want to start writing a new KeePass file from scratch you first have to build up your database model. This will be done using the provided builders.\r\nAfter the model has been constructed you can use the __KeePassDatabase__ class to write the KeePass database to a stream.\r\n\r\n```java\t\r\n\t// Build KeePass model\r\n\tGroup root = new GroupBuilder()\r\n\t\t\t\t\t.addEntry(new EntryBuilder(\"First entry\").username(\"Peter\").password(\"Peters secret\").build())\r\n\t\t\t\t\t.addGroup(new GroupBuilder(\"Banking\")\r\n\t\t\t\t\t\t\t.addEntry(new EntryBuilder(\"Second entry\").username(\"Paul\").password(\"secret\").build())\r\n\t\t\t\t\t\t\t.build())\r\n\t\t\t\t\t.build();\r\n\t\t\t\t\r\n\tKeePassFile keePassFile = new KeePassFileBuilder(\"writingDB\")\r\n\t\t\t\t\t.addTopGroups(root)\r\n\t\t\t\t\t.build();\r\n\t\t\t\t\r\n\t// Write KeePass file to disk\r\n\tKeePassDatabase.write(keePassFile, \"MasterPassword\", new FileOutputStream(\"Database.kdbx\"));\r\n```\r\n\t\r\nFor more usages have a look into the unit test classes.\r\n","funding_links":[],"categories":["API libraries"],"sub_categories":["Other clients"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcternes%2Fopenkeepass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcternes%2Fopenkeepass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcternes%2Fopenkeepass/lists"}