Python KDF - Master Key and Derivatives

430 Views Asked by At

I need help with the following problem statement -

The encrypted file can be opened by following combinations (either any 2 DK, or 1 MK)-

DK1 + DK2
DK1 + DK3
DK2 + DK3
DK1 + DK2 + DK3
MK

Any heads-up with Python KDF logic. Any good documentation/ reference will also suffice the purpose. I tried deriving keys with KDF(MK, "pass1") -> DK1 but then the combination logic didn't work.

1

There are 1 best solutions below

0
On

The general class of problem is called "secret sharing". In this instance, one solution would be to encrypt the file with a single key K, then generate and attach three encrypted versions of K, each encrypted by one combination of two DKs. (I assume that all DKs can be derived from MK.)

Note that questions like these, which are more about cryptographic protocols than about programming, would probably be better asked on crypto.