Skip to content
Jérémy JAMET edited this page Aug 31, 2021 · 1 revision

It is possible to attach entry files to facilitate access to specific information, but it is important to understand that attachments are particular files that can impact the size and performance of opening and saving your database, so handle them with knowledge.

Formats

Any type of file can be imported as an attachment into a KeePass database, they are transformed into binary format, ordered, compressed and encrypted in order to be stored. But in order to maintain optimal performance, only two formats are recommended :

Recommended

  • Plain text files. These files have the particularity of being extremely simple and do not have unnecessary metadata that would overload the files without reason. Generally, this is done to store key, for example when you generate a pair of encryption keys (PGP, SSH, etc...) or a text that is not intended to be directly visible in a custom entry field.
  • Images files. Image files are useful for accessing a textual code in image form (Barcode, QR code, Data Matrix, etc...) KeePassDX has a built-in image viewer and makes it convenient to view these files without having to download them to the device. Prefer compressed image files, such as the JPEG format. It is possible to import images of official documents (such as an ID card) but be careful not to import a too large image.

Notes : Don't hesitate to create a custom field if the text information to store is relatively small in order to have a direct access to the information from the Magikeyboard or the Autrofill. KeePassDX can display the generated image codes if you import them as attachments, but prefers to delegate the QR code generation to a dedicated app that do it much better because specialized in this task.

Not recommended

Content aggregator files (PDF, ODT, DOC, DOCX, ODG, PSD, etc...) are not recommended because they have a lot of metadata that unnecessarily burden the imported files and the generated database file. Aggregator files combine styles for text and images that can very often be reduced to simple text, so feel free to extract the necessary information from these files for storage.

It is not recommended to import files larger than 5MB.

Performance

Why this quest for the smallest attachment size?

  1. The bigger an attachment file is, the more it will weigh down your final database file, so it will be harder to synchronize if you copy it between different storage locations.
  2. The bigger an attachment file is, the more Keepass data will need to be decrypted, so your database will take longer to open.

Storage

The storage format is different depending on the database version you use. But KeePassDX will always try to optimize the storage of attachments in the database file (which is not the case for all KeePass clients).

  • The attachments are ordered in the keepass file header to be all compressed. The compression is done in GZIP by default and is completely transparent to the user, as the decompression of files for image display and recovery during download is done on the fly. You can select not to compress the attached files if another client does not support this feature from the database settings.
  • Identical files are included only once in the database. This saves a lot of space when you use the same attachment in different entries, KeePassDX will recognize the file signature and store only one copy that will be referenced in several places. (Many other keepass clients don't do this, check for yourself)

Alternative

If you want to store large files securely, it is recommended not to use the KeePass format but rather a virtual disk that will be specifically created for this purpose.

A virtual hard disk behaves like an encrypted file when not mounted and decrypted (so move it where you want), and behaves like a hard disk when mounted and decrypted. You can obviously use your KeePass database to store the passphrase to decrypt the virtual disk.

How to?

Now that you have all these notions in mind, that your file is not too big and that it contains only the necessary information, you can upload it.

Nothing could be easier, from your entry, click on the "paper clip" icon and select the file you want to import. If it is an image file, a preview will be displayed and you can see it in the internal viewer.

It is then possible to retrieve the attached files by downloading them from the database.

Clone this wiki locally