.. toctree:: Vault ===== Vault in Enpass is a secure place where all the data is kept in encrypted format. It is well structured and consists of following files: * **vault.json:** This file contains plaintext info about your vault that is required for synchronization. * **vault.enpassdb:** This is a SQLCipher database which is 100% encrypted using your vault key. It contains all your data except attachments more than the size of 1KB. Bigger attachments are saved in a separate SQLCipher database. * **.enpassattach:** These are SQLCipher database files for each attachment with size more than 1KB, encrypted by a randomly generated key that is stored in vault.enpassdb. Vault can be accessed only with a Vault Key, which in turn derived from master password that only you know. Vault Key --------- A Vault Key is the cryptographic key that is used for performing the AES encryption and decryption of your data. It is derived from your Master Password (and Keyfile, if used) using 100,000 rounds of PBKDF2- HMAC-SHA512. Along with the master password, you can also use a Keyfile that acts as a second factor for generating vault key. Master Password (Something you know) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The vault key that is used in AES for encrypting your data is derived from your Master Password which always stays in your possession only. Neither your master password nor any of its derivative is recorded within Enpass (except in case when you enable Quick Unlock or use Multiple Vaults). If you forget your master password, there is no way to recover your data. Keyfile (Something you have) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A Keyfile, if used in addition to Master password adds more randomness in generation of vault key. If your master password is somehow compromised, it makes it mandatory for an attacker to have access to an additional file that only you have somewhere on your system. Desktop version of Enpass can generate 64-bit random keys for you. Like Master Password, if you lost your keyfile, there is no way to recover your data. SQLCipher and Enpass ^^^^^^^^^^^^^^^^^^^^ SQLCipher is an open source extension to SQLite that provides transparent 256-bit AES encryption of database files. One can find complete design details of SQLCipher `here `_ And here is how SQLCipher is configured in Enpass: 1. The encryption algorithm is 256-bit AES in CBC mode. 2. Enpass derives key data from your master password (and keyfile if used) using 100,000 rounds of PBKDF2-HMAC-SHA512 and use it as a raw key for SQLCipher. Each database is initialized with a unique random salt in the first 16 bytes of the file. This salt is used for key derivation and ensures that even if two databases are created using the same password, they will not have the same encryption key. 3. Each database page is encrypted and decrypted individually. The page size is 1024 bytes. 4. Each page has it’s own random initialization vector. The IV is generated by a cryptographically secure random number generator and is stored at the end of the page. IVs are regenerated on write to avoid reuse of the same IV on subsequent writes of the same page data. 5. Every page write operation includes a Message Authentication Code (HMAC_SHA1) of the ciphertext and the initialization vector at the end of the page. The MAC is checked when the page is read back from disk. If the ciphertext or IV has been tampered or corrupted, the HMAC check will cause SQLCipher to report a problem with the database. 6. SQLCipher does not implement its own encryption. Instead, it uses the widely available encryption libraries like OpenSSL libcrypto. In case of Enpass, OpenSSL libcrypto is being used as encryption provider.