# RSA: Decrypting message with public key and private key

I am trying to decrypt a message which its ciphertext in Hex A3 BB 05 00. The original plain text is 8 bits and it is encrypted by a 32 bits RSA key.

I have successfully found the public key is $$(e=947,n=2671079)$$ and the private key is $$(d=713604)$$.

Then, I try to convert the Hex string to integer 00 05 BB A3 (Little Endian) $$=375715$$.

Finally, I calculate $$C^d \mod n = 375715^{713604} \mod 2671079 = 544824$$.

Calculate in python: C**d % n

My problem:

1) what does $$544824$$ mean? Is it the original plain text or I need to further converting this number?

2) The plain text should be 8 bits, why the result I get is larger than 8 bits?

thanks!

• In Python don't use ** % n use pow(c,d,n) this is more effective. – kelalaka Nov 9 '19 at 14:35

Your ciphertext is A3 BB 05 00
In RSA, the ciphertext is always larger than the original data. In this case, the keys are 32 bits, which is 4 bytes, and A3 BB 05 00 is four bytes
• Can you prove this statement  the ciphertext is always larger than the original data. What if my plaintext is $n\hbox{-}1$ – kelalaka Nov 9 '19 at 19:39
• This is wrong. $N$ is an upper bound for both the message and the ciphertext - there is no asymmetry. At least as long as plain RSA is concerned ( and not something like RSA-OAEP. – tylo Nov 9 '19 at 23:40