~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/include/ecryptfs.h

  • Committer: Dustin Kirkland
  • Date: 2009-01-22 00:58:21 UTC
  • Revision ID: git-v1:d0d0782ff84bd0c8deead3c695a7e13f7874b175
filename encryption userspace support

Recent changes to the ecryptfs kernel code has added support for
filename encryption.

The basic userspace support was a added a few weeks ago.  You can
specify the key in the kernel keyring to use as a mount parameter,
with:
  ecryptfs_fnek_sig=0000000000000000

This patch adds a couple of conveniences, mainly in support of using
encrypting filenames easily with the encrypted-home and
encrypted-private features of ecryptfs.

In these scenarios, the filename encryption key is dynamically
(but programmatically) generated using the mount passphrase.

The mount passphrase is salted, hashed 65536 times using sha512,
converted to hex, and truncated to 16 digits long (128 bits).  This
value is used as the filename encryption passphrase.

Should the filename encryption password be compromised, one would
have to reverse this process.  We have designed this to be
cryptographically very difficult.

The signature of the filename encryption key (often abbreviated
"fnek") should be specified in ~/.ecryptfs/Private_fnek.sig.

If this file exists and contains a valid signature, the
mount.ecryptfs_private helper will specify this key in the mount
options as described above.

The pam_ecryptfs modules will continue to insert the wrapped
passphrase into the kernel keyring.  I have modified the base
library functionality to unconditionally also insert the fnek
passphrase.  THIS SHOULD BE FIXED IN A SUBSEQUENT COMMIT.

Also, the ecryptfs-setup-private utility needs to be enhanced
to write out the Private_fnek.sig file.  This may necessitate
a new binary utility to perform this operation.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
#define ECRYPTFS_SALT_SIZE 8
80
80
#define ECRYPTFS_SALT_SIZE_HEX (ECRYPTFS_SALT_SIZE*2)
81
81
#define ECRYPTFS_DEFAULT_SALT_HEX "0011223344556677"
 
82
#define ECRYPTFS_DEFAULT_SALT_FNEK_HEX "9988776655443322"
82
83
/* The original signature size is only for what is stored on disk; all
83
84
 * in-memory representations are expanded hex, so it better adapted to
84
85
 * be passed around on the command line */
522
523
                                 struct ecryptfs_name_val_pair *nvp_head);
523
524
int ecryptfs_add_passphrase_key_to_keyring(char *auth_tok_sig, char *passphrase,
524
525
                                           char *salt);
 
526
int ecryptfs_add_filename_key_to_keyring(char *auth_tok_sig, char *passphrase,
 
527
                                           char *salt);
525
528
int ecryptfs_add_key_module_key_to_keyring(char *auth_tok_sig,
526
529
                                           struct ecryptfs_key_mod *key_mod);
527
530
int ecryptfs_read_salt_hex_from_rc(char *salt_hex);
539
542
                          struct ecryptfs_ctx *ctx, char *key_mod_alias);
540
543
int generate_passphrase_sig(char *passphrase_sig, char *fekek, char *salt,
541
544
                            char *passphrase);
 
545
int generate_fnek(char *fnek, char *salt, char *passphrase);
542
546
int
543
547
generate_payload(struct ecryptfs_auth_tok *auth_tok, char *passphrase_sig,
544
548
                 char *salt, char *session_key_encryption_key);