# Crypto lib that use files instead of passphrase [closed]

I would like to program an application to allow people to encrypt files without using a password or pass-phrase but an arbitrary long file.

I'm searching for a library that allows me to safely create a front-end.

Example: user 1 on PC1 encrypt the picture selfie.png (size 2 MB) using the key-file ketfile.foo (size 2 MB), then send this file to user2 on PC2 that use keyfile.foo to decrypt selfie.png. Of course I assume that the keyfile.foo was "securely" sent.

This idea come from the Vernam Cipher "Unbreakable" cipher.

• You may simply read file content (as bytes-string or bits-string) and pass it to the encryptor as the key. – Reversal Apr 22 '16 at 10:43
• Good Point, but I'm asking myself if this solution is the most efficient or is practicable because some tools desn't read the pass-phrase from the command-line via parameter (they ask in an interactive way) – metas Apr 22 '16 at 10:53

You should use a password based key derivation function (PBKDF such as Argon2, scrypt or bcrypt) if you suspect the file to be low entropy (less than $2^{128}$ plausible possibilities) and use a key based key derivation function (KBKDF such as HKDF or KDF2) in all the other cases. For the actual encryption AES-EAX is your mode of choice for files that get larger than 60GB and AES-GCM for anything smaller.