keemobile / kotpass

The library offers reading and writing support for KeePass (KDBX) files in Kotlin
MIT License
17 stars 0 forks source link

Incompatibility with pykeepass #24

Closed aivanovski closed 3 months ago

aivanovski commented 3 months ago

Started as this issue https://github.com/aivanovski/keepassvault/issues/240, there are links to other issues inside, but I'm not sure if they provide some clarity.

It looks like there is some incompatibility with pykeepass library and after any field was inserted into database created by kotpass, kotpass interprets that fields as EntryValue.Encrypted. Before modification only password field was EntryValue.Encrypted.

Here are steps to reproduce: 1 - Create new database with kotpass (KeePassDatabase.Ver4x.create all default parameters), check that target field is EntryValue.Plain (use field notes, url, username) 2 - Modify target field with pykeepass 3 - Open database with kotpass, check the type of target field Actuals result: target field is EntryValue.Encrypted Expected result: target field is EntryValue.Plain

Python code for step 2:

from pykeepass import PyKeePass

kp = PyKeePass('test.kdbx', password='abc123')

entry = kp.root_group.entries[0]
entry.notes = "Notes from pykeepass"

kp.save()

And database file, password is abc123: test.kdbx.zip

Anvell commented 3 months ago

Hello,

could you please post KDBX file produced by PyKeePass?

aivanovski commented 3 months ago

pykeepass-modified.kdbx.zip

aivanovski commented 3 months ago

This turned out to be a pykeepass problem, this issue was fixed in https://github.com/libkeepass/pykeepass/pull/381 Will be available in pykepass > 4.0.7