# Using One Time Pad and RSA compared to using only One-time Pad

Here I implemented One Time Pad first for only one time and then I used RSA algorithm to encrypt the message.

For RSA algorithm, I pick p = 2143 and q = 3257 value which does not share any common factors and generate a random value between 1 and (p-1)*(q-1). And then generate a public key and private key for RSA encryption and decryption.

My question is: Is it more secure than only use One Time Pad to encrypt the message?

• OTP, done right, is 100% secure; how can you have more than 100%? – dandavis Apr 7 '17 at 19:23
• Could you please expand on how you use RSA? When and how do you manage the key(s)? A bit more detail should lead to a more accurate answer. – Paul Uszak Apr 7 '17 at 21:12
• @dandavis : ​ For example, one could have non-malleability. ​ ​ ​ ​ – user991 Apr 8 '17 at 5:48
• So you create cipher text using a OTP, then you encrypt the cipher text again with RSA? So you have two layers of encryption. The question then becomes generically are multiple layers of encryption more secure than a single layer? That's a good question and I don't think that the answer is simple. – Paul Uszak Apr 8 '17 at 12:34
• @PaulUszak: I agree it depends on more than what we know from OP, but i said "done right"... – dandavis Apr 8 '17 at 21:06

## 1 Answer

It depends on what you would use the RSA algorithm for since a one-time pad (assuming you implement it correctly) should achieve perfect secrecy, which means its ciphertext cannot be cracked. RSA is one of the first public-key cryptosystems that can also be considered as secure when you are using large enough primes.

So to answer your question, it cannot be more secure than using OTP only since it simply provides the perfect secrecy. But OTP does have its limitations and that's why we have other encryption schemes and algorithms so that we can choose the most suitable one in different situations.