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.

  • $\begingroup$ @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. $\endgroup$
    – mroknocy
    Jun 25, 2018 at 17:44
  • $\begingroup$ @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. $\endgroup$ Jun 25, 2018 at 20:03

1 Answer 1


You are looking for commutative encryption rather than homomorphic encryption. Also Elgamal is probabilistic, which means in each encryption a fresh randomness is added to the ciphertext, which means if the same plaintext is encrypted twice, the ciphertexts will be different.

For a deterministic commutative encryption scheme, you can use RSA encryption (SRA in your comment).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.