# What is an example of ElGamal homomorphic double encryption?

I am looking for such an cipher algorithm that is based on asymmetric cryptography where the order of encrypting is irrelevant.

For example: There is a message "x", Bob encrypt that message with his key and passes result "zz" to Alice. Alice encrypt that message with her key and receives: "xyz". There is a message "x". Alice encrypt that message with her key and passes result "ui" to Bob. Bob encrypts with his key and receives "xyz".

What is the most important, is that resulting encrypted text is the same.

I have heard that maybe homomorphic ciphers have such properties and have tried with Elgamal but no results were OK.

I would be glad if someone could help me with some example that matches my problem.

• @ChangyuDong Thank you for your answer. I have made some further reading and discovered SRA encryption algorithm that does his job. asecuritysite.com/encryption/comm2 I need to be sure that one of generated keys is only one way - decryption isn't possible. Is it correct to select encryption key e, which share some factors with PHI? It looks to me thet it will be impossible to generate decryption key then but i'm not sure if it is safe method. Jun 25, 2018 at 17:44
• @mroknocy what do you mean? For Alice and Bob, they each has a key pair $(e_i,d_i)$ in which $e_i$ is the encryption key and $d_i$ is the decryption key. Do you mean you don't want one of the parties to have the decryption key? This is easy but then the doubly encrypted ciphertext ('xyz' in your question) cannot be decrypted. Jun 25, 2018 at 20:03