For my project in uni I need to combine asymmetric and symmetric cryptosystems. I wanted to do thing with AES and RSA but it's a little difficult for me and I want something easier. So I thought that maybe I can go with these steps:

  1. the message is encrypted with a symmetric algorithm (XORcipher)
  2. the key of the symmetric algorithm is encrypted by the asymmetric algorithm (RSA)
  • Welcome to the community. What's your goal? Why do you need to combine them if you understand that yourself? Nov 18, 2023 at 19:08
  • Why don't you use just libsodium Authenticated encryption it is well maintained library and has many ports, too. You will get, confidential, integrity, and authentication>
    – kelalaka
    Nov 19, 2023 at 19:40

1 Answer 1


Using XOR for encryption requires you to have a key which is at least as long as the data you want to encrypt - or you would need to repeat the key which is insecure. This means there is no actual advantage for a hybrid encryption using RSA+XOR, you could directly encrypt the data with RSA and skip key generation and XOR.

But, you can only encrypt a short amount of data with RSA - see RSA maximum bytes to encrypt, comparison to AES in terms of security?. This limits the size of the key you can encrypt and thus also the size of the message.

  • I think p_1+p_2+...+p_n key length is already enough, if p_1*p_2*...*p_n is larger than the data. :-)
    – peterh
    Nov 28, 2023 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .