Need help with gokeepasslib?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

tobischo
155 Stars 24 Forks MIT License 337 Commits 2 Opened issues

Description

A library to read and write keepass 2 files written in go

Services available

!
?

Need anything else?

Contributors list

# 390,101
XML
banking
fintech
Shell
176 commits
# 151,485
C
Shell
peer-to...
TypeScr...
67 commits
# 590,073
Go
39 commits
# 715,831
Go
8 commits
# 173,473
faceboo...
google-...
Twitter
forensi...
5 commits
# 229,278
Perl
classif...
Google
Django
2 commits
# 98,825
beagleb...
Raspber...
Arduino
bluetoo...
2 commits
# 368,322
Shell
conky
curl
mpd
1 commit
# 73,439
Go
macOS
osx
macos-s...
1 commit
# 191,741
Apache ...
PHP
tornado
OpenCV
1 commit

gokeepasslib

Travis Build state

gokeepasslib is a library which allows reading Keepass 2 files (kdbx).

Note: only Keepass v2.30 or higher is properly supported since earlier versions do not allow empty XML tags but expected self-closing tags (which is valid XML but not really supported by Golang on XML marshaling) Basically: this lib can probably read most Keepass2 files, but only Keepass v2.30 can be expected to read files created in this lib.

Installing

Use

go get
to retrieve the latest version:
go get -u github.com/tobischo/gokeepasslib

Include it in an application (modulized):

import "github.com/tobischo/gokeepasslib/v3"

For non-modulized applications use:

import "github.com/tobischo/gokeepasslib"
Note that this may cause breaking changes when updating from a previous version.

Example: reading a file

package main

import ( "fmt" "github.com/tobischo/gokeepasslib/v3" "os" )

func main() { file, _ := os.Open("examples/example.kdbx")

db := gokeepasslib.NewDatabase()
db.Credentials = gokeepasslib.NewPasswordCredentials("abcdefg12345678")
_ = gokeepasslib.NewDecoder(file).Decode(db)

db.UnlockProtectedEntries()

entry := db.Content.Root.Groups[0].Groups[0].Entries[0]
fmt.Println(entry.GetTitle())
fmt.Println(entry.GetPassword())

}

Note the

db.UnlockProtectedEntries()
call: you have to unlock protected entries before using the database and call
db.LockProtectedEntries()
before saving it to ensure that the passwords are not stored in plaintext in the xml. In kdbx files, which are encrypted using the file credentials, fields are protected with another stream cipher.

Example: writing a file

See examples/example-writing.go

Example: deleting a file

See examples/example-deleting.go

TODO

  • Improve code readability
  • Write more tests

Contributing

CONTRIBUTING

Changelog

CHANGELOG

License

LICENSE

Copyright

Copyright © 2020 Tobias Schoknecht. All rights reserved.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.