1

I am looking for a way to encrypt a file using many passwords for decryption. I was use AES encryption as solution or any compatible one.

I have suggestion:

Encrypt file with one password, and when we decrypt, we can use many passwords but related to the first one like (RANDOM_KEY.password.RANDOM_KEYS) and encode it ... in the decrypt function we decode the password and remove random_keys.

I want make a file decryptable with many passwords, but the other passwords generated from the main password ... like this a user1 can't share the password with a user2.

But how to make this pratical in a C language for example ?

3

You can encrypt the file with a randomly generated key. And then you can encrypt that key many different ways.

Some terminology and notation. Alice will have her password, pA which is processed by a Key Derivation Function (KDF). The result of running the KDF on pA will be Alice's Key Encryption Key (KEK). Let's just call the randomly generated key that encrypts the file, k.

So in Alice's case k will be encrypted with her KEK which is derived from running the KDF on pA. So

KEKA = KDF(pA)

WA = Enc(withKey: KEKA), data: k)

WA is the "wrapped" key. Along with the file encrypted with k, you store the wrapped keys: WA, WB, WC, ...

You may wish to look at RFC 3394 for recommended ways to encrypted a key with a KEK.

1

Quite simple.

Create a random key and use this as your AES key.

Use a Key Derivation function for each of the desired decryption Passwords.

Now you have

  • The random key used for encryption.
  • The passwords which can be used derive keys.

What you store:

  • For each password, create an XOR of
    • the random key
    • the derived key derived from the authorized password

So for each password, you have an XOR result.

If a password is given, you can easily re-derive the key, and XOR against the XOR result to get the original random key again.

Do not store the random key. Do not store the derived key. Only store the XOR result of these combined. And of course do not store the password.

If one of the users becomes de-authorized, you'll have to repeat the process with a new random key. Any previously distributed material will always be available using their original passwords.

0

There is no encryption that provides this as far as I know. However, a middle ground for your kind of problem could be the use a of a key-file used to encrypt the data. Then you encrypt the key n times with the respective key of the users.

Each user will be able to decrypt the key with their own credential, and therefore be able to decrypt the file.

For further information, you can refer to little bear's answer on this question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.