How to get secret key based on multiple passwords? e.d we have cipher encrypted by combination of passwords "qwe" and "asd", and our purpose to decode the cipher using any of passwords above separately?
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It only takes a minute to sign up.Sign up to join this community
You can do this by generating a (random) encryption key for the data and then encrypting that key separately with each of the passwords, using some password-based encryption.
To decrypt the user can use any of the passwords to decrypt the encryption key, then use that to decrypt the actual data. If the password-based encryption used is authenticated encryption, the decrypter can decrypt each of the encrypted keys and use the one where the authentication checks out.
It is basically a two level encryption:
passphrase (possibly passed throught a KDF) is used for master key encryption
master key is used for data encryption
multiple key-slot, once for every passphrase are possible
there is only one master key
there are as many encrypted master keys as the number of passphrases
You can find a valid example in LUKS (Full Disk Encryption solution) https://gitlab.com/cryptsetup/cryptsetup