kaitai-io / kaitai_struct_formats

Kaitai Struct: library of binary file formats (.ksy)
http://formats.kaitai.io
695 stars 201 forks source link

Keepass KDBX #333

Open KOLANICH opened 3 years ago

KOLANICH commented 3 years ago
meta:
  id: keepass_kdbx
  title: Keepass KDBX XML
  application:
    - Keepass 2
    - KeepassX
    - KeepassXC
    - KeePassDroid
  file-extension: kdbx 
  xref:
    #rfc: # TBD, see rfc.txt in doc-ref
    wikidata:
      - Q762660
      - Q4042120
      - Q28974968

doc: |
  Keepass password database

doc-ref:
  - https://github.com/keepassxreboot/keepassxc-specs/blob/master/kdbx-xml/rfc.txt
  - https://keepass.info/help/kb/kdbx_4.html
  - https://gist.github.com/lgg/e6ccc6e212d18dd2ecd8a8c116fb1e45
  - https://gist.github.com/msmuenchen/9318327
  - https://github.com/keepassx/keepassx/tree/master/src/format
  - https://github.com/libkeepass/pykeepass/tree/master/pykeepass/kdbx_parsing
  - https://github.com/cternes/openkeepass
WiP: https://gist.github.com/u1735067/a078613c7336d93441f9c622785eb29f
cab404 commented 2 years ago

WiP is a dead link now

KOLANICH commented 2 years ago

removed. Thanks for reporting

generalmimon commented 2 years ago

WiP is a dead link now

There is still https://gist.github.com/u1735067/a078613c7336d93441f9c622785eb29f - I don't know how complete it is, but at least it's something. But there's no /meta/license key, so we would have to ask @u1735067 to release it under an open-source license (https://spdx.org/licenses/), otherwise we cannot use any substantial part of it.

u1735067 commented 2 years ago

Hi, thanks for the notification, I added a license (ISC, MIT simplified) to that file (and removed a doc entry which wasn't mine but copy/pasted from https://gist.github.com/msmuenchen/9318327). I'm not sure however what is the preferred way to indicate an author (no mentions in https://doc.kaitai.io/user_guide.html#meta / https://doc.kaitai.io/ksy_style_guide.html#meta ?), so I put it in meta.authors. Also, the language specs probably have changed since I created it (and I possibly didn't used the best patterns/practices too), just so you're aware :)

I'm also not sure I handled all different versions cases, it was more a minimal format parser to check how the encryption work.

If it's ok to mention authors this way (ie. is meta.authors allowed in the language specs?), I have something like 3 others KSY in my gists for which I could do the same (with the same WIP/draft warning).

generalmimon commented 2 years ago

@u1735067 Sorry for the delay.

I added a license (ISC, MIT simplified) to that file

Great, thanks!

If it's ok to mention authors this way (ie. is meta.authors allowed in the language specs?), I have something like 3 others KSY in my gists for which I could do the same (with the same WIP/draft warning).

Thanks for bringing this issue up. AFAIK, we haven't properly dealt with this yet, because format spec authors mostly commit their .ksy descriptions to the format repo themselves and they're usually satisfied with their name just being visible in the Git history. Occasionally, when authors want other people to know they authored it, they add a line to the doc block, like this:

spectroscopy/avantes_roh60.ksy:L35

meta:
  id: avantes_roh60
# ...
  endian: le
doc: |
  ...

  Written and tested by Filip Dominec, 2017-2018

(Note that doc is not a subkey under meta, it is at the topmost level, i.e. on the same level as meta)

cad/monomakh_sapr_chg.ksy:17

doc: |
  ...

  Written and tested by Vladimir Shulzhitskiy, 2017

media/wav.ksy:68-69

doc: |
  ...

  This Kaitai implementation was written by John Byrd of Gigantic Software
  (jbyrd@giganticsoftware.com), and it is likely to contain bugs.

Therefore, I ask you to use the same approach.

(ie. is meta.authors allowed in the language specs?)

It isn't, the compiler would complain about an unknown key.