-2

I'm looking for some sort of three way encryption algorithm. So you three pairs of data (components) are encrypted, and one encrypted component can be decrypted by a key that is derived from the other two encrypted components. I thought I read about an algorithm like this in my uni years, but I can't seem to find it. I would appreciate any of the pointers I can get on this.

So to get down on what I mean, let's say I have the values A, B, C. Where encrypted versions of these are denoted as A', B', C'. In order to decrypt A' into A, a decryption key has to be derived from B' and C'. In this sense the components store the actual data intended to hide, but also store the decryption key for the other component, so the encryption can be lifted when all three components are known.

Initially I thought with the cumulative nature of the xor operation it could be accomplished with that. My idea was by creating a A' = A ^ sha1(B) ^ sha1(C), B' = B ^ sha1(A) ^ sha1(C). You could combine the keys and cancel out sha1 components. But this doesn't seem to work. So I'm looking for some algorithm that could work like what is mentioned above.

Lawrence Kok
  • 1,568
  • 11
  • 29
  • You can try to ask on https://cs.stackexchange.com or https://softwareengineering.stackexchange.com/ – Vadim Kotov Dec 14 '17 at 14:14
  • Related, but not the same: https://stackoverflow.com/questions/597188/encryption-with-multiple-different-keys – Mnebuerquo Dec 14 '17 at 14:31
  • @VadimKotov when referring other sites, it is often helpful to point that [cross-posting is frowned upon](https://meta.stackexchange.com/tags/cross-posting/info) – gnat Dec 14 '17 at 14:34
  • @gnat You're right, thanks – Vadim Kotov Dec 14 '17 at 14:37
  • @gnat OK, cross-posting is frowned upon, please explain to the OP what he should do given that this is not the correct site. – zaph Dec 14 '17 at 14:47
  • Consider asking in [Cryptography](https://crypto.stackexchange.com/) and deleting this question. But you need to provide a clear description and probably an explanation on what you are trying to accomplish. – zaph Dec 14 '17 at 14:49
  • You state: "The decryption for A' should be based on the combination of B' and C'.", what does "based on" mean? – zaph Dec 14 '17 at 14:51
  • @zaph - well maybe 'based on' is a wrong expression. What I mean somehow B' and C' are encrypted in a way, the combination of both B' and C' can be used to decrypt A'. While for B' this would be A' and C'. – Lawrence Kok Dec 14 '17 at 14:56
  • 1
    A clearer version of this question would be on topic in crypto. – President James K. Polk Dec 14 '17 at 14:56
  • 1. Add additional information the the question, that is improve the question. 2. Encrypotion involves keys and data, there is no mention of keys. 3. It seems that you do not have a clear idea of what you want. Write a narrative of the actions. – zaph Dec 14 '17 at 15:20
  • @zaph I changed the question, hopefully structuring it better. I do have a clear idea of what I want, and I am describe it to the best of my abilities what I want the 'effect' to be, but the question to stackoverflow is 'what algorithm to use'. – Lawrence Kok Dec 14 '17 at 17:20

1 Answers1

0

Requirement: Given three data pieces data_A, data_B and data_C, encrypt each in such a manor that it requires all three to create the encryption key necessary to decrypt any one.

  1. Create a master_key, split into three components (split_key_A, split_key_B and split_key_C.

  2. Derive an encryption_key from the master_key with PBKDF2.

  3. Individually encrypt each data_ with the encryption_key and prepend the encrypted data with the associated split_key_.

  4. To decrypt, get all three encryptions, split off the split_keys and combine them into the master_key. Derive the encryption_key from the master_key with PBKDF2.

  5. Decrypt any of the data_ with the encryption_key.

Note: I an not a cryptographic expert, do not rely on this for production work, it may not be secure.

zaph
  • 111,848
  • 21
  • 189
  • 228