PHPackages                             iqb/ecryptfs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. iqb/ecryptfs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

iqb/ecryptfs
============

Userland EcryptFS library written in PHP.

14PHP

Since Feb 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/iqb/ecryptfs)[ Packagist](https://packagist.org/packages/iqb/ecryptfs)[ RSS](/packages/iqb-ecryptfs/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Userland EcryptFS library written in PHP
========================================

[](#userland-ecryptfs-library-written-in-php)

[![Build Status](https://camo.githubusercontent.com/ac108cc6cde1d1a0635341f4c61c1ccd13d1a8060036143d8d519fa3bfa9fffb/68747470733a2f2f7472617669732d63692e6f72672f6971622f65637279707466732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/iqb/ecryptfs)[![Scrutinizer Score](https://camo.githubusercontent.com/cb95c8e6c1971d29abbf6c78325df8abda76dcb302d3ea4ac53ed2b09aba1cb4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6971622f65637279707466732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/iqb/ecryptfs)[![Code Coverage](https://camo.githubusercontent.com/b43132889e6b87ff0fb210b77324044fb7c9d051e50e3d2518993e48af070d14/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6971622f65637279707466732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/iqb/ecryptfs)[![Software License](https://camo.githubusercontent.com/cab72aa2f20de080d74edadd1ae7b7eb7827bbde1488184096226f38a9d65504/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4c47504c25323056332d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

[EcryptFS](http://ecryptfs.org/) is a Linux file system that allows you encrypt your files (and filenames). It is part of the Linux Kernel and is used e.g. by Ubuntu to encrypt users home directories.

EcryptFS uses two (possibly different) keys for encryption:

- the FNEK (File Name Encryption Key) for encrypting/decrypting files names
- the FEKEK (File Encryption Key Encryption Key) for encrypting/decryption the file specific random key the file contents is encrypted with

By default, these two keys are derived from a passphrase.

Encrypting/Decrypting file names
--------------------------------

[](#encryptingdecrypting-file-names)

Encrypted file names start with the prefix `ECRYPTFS_FNEK_ENCRYPTED.` followed by the encrypted original file name. E.g. `ECRYPTFS_FNEK_ENCRYPTED.FWayVrRYlN446EY.WUc7GBFqG9GB6qF3eRmJZ7NYS7ANeS4Gfi9c34ZDTU--` decrypts to `loremipsum.txt` you use the passphrase `test`.

The code for encrypting and decrypting file names looks like this:

```
