Search code examples
encryptionpasswordsescrow

file encryption into N files, but with at least and only M required to decrypt?


I think this technique may have a name, but I can't remember it to google it.

What methods are there to encrypt a file (or password, etc.) into N files, of which any M (less than N) can be used to recover the complete original file, but any less than M are completely useless (say on an order equivalent to cracking 1024-bit AES).

e.g. I encrypt all the company's passwords into N files, giving N company executive each 1 file. Any N-M executives can die with me in a fiery plane crash, and the remaining M can still recover all the passwords necessary to continue the business. But M-1 executives can't go rogue and secretly sell all the company's secret data to the competition.


Solution

  • The class of algorithm you're after is called a Secret Sharing Scheme, and the most widely implemented example is Shamir's Secret Sharing Scheme.

    Generally, what is done is to generate a random key for a symmetric cipher, like AES; encrypt the plaintext with that random key; then split the random key into N shares using the secret sharing scheme. The ciphertext then does not have to be kept secret; only the key shares.