Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a secure cryptographic algorithm where encryption and decryption can be in any order?

I'm looking for a cryptographic algorithm that satisfies the following rules:

E(key1, E(key2, Message)) = E(key2, E(key1, Message))

And obviously the same for decryption as well.

This is probably a long shot as I doubt such an algorithm exists but thought it's worth asking.

Thanks

like image 404
David Read Avatar asked Dec 05 '22 03:12

David Read


1 Answers

RSA with the same modulus will do this. Raising to the power a then the power b is the same as raising to power b then a.

But you wouldn't normally use RSA to encrypt your message, you'd use it to encrypt a key - RSA and most asymmetric cryptogrpahy is very time consuming.

Maybe you're after a symmetric algorithm with that property?

like image 153
John Avatar answered Jun 17 '23 18:06

John