I am looking for a way to do multi-key encryption with the set number of decryption keys. The goal is to take a file, encrypt it and generate several decryption keys, in order to decrypt several (not just one, but all either) keys must be used.

Use case:

Receive image.jpeg Generate an encrypted image.jpeg.crypt, image.jpeg.key1, image.jpeg.key2, image.jpeg.key3 Distribute keys to three different persons

After this 2 keys must be present to decrypt, but any 2 of the mentioned 3.

In perfect scenario i should be able to say: "Generate X keys, out of which Y keys will be required to decrypt".

P.S. This is not a duplicate of Encryption strategies for multi users access in production systems where any one key decrypts, nor is it a duplicate of Doubling up or cycling encryption algorithms where every key must be provided.

  • 1
    I thin k the term you're looking for is 'quorum' encryption/decryption
    – symcbean
    Nov 4, 2013 at 16:28

1 Answer 1


You are looking for secret sharing algorithms. Once such scheme was proposed by Shamir, called Shamir's secret sharing algorithm.

Quoting from Wikipedia:

... a secret is divided into parts, giving each participant its own unique part, where some of the parts or all of them are needed in order to reconstruct the secret.

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