# OpenSSL RSA same plaintext but different ciphertext

how OpenSSL RSA work ?

I generate public (n,e) and private key (n,d) then I encypted a file by :

openssl rsautl -encrypt -in plaintextFile -inkey privkey.pem -out cipher00


let's note the result C

and I tried to decrypt it by doing C^d (modulo n) but it doesn't work.

I think this is because OpenSSL adds some random value to my plaintext before the encryption. If I run the previous command once again on the same plaintext I have a different ciphertext.

How can I remove this random during the decryption?

-
In general, identical plaintext should result in a different ciphertext. Otherwise you leak information to an attacker. If the attacker can guess what a specific ciphertext means he knows that a repetition of the ciphertext means the same thing. This goes for symmetric ciphers (the use of an IV or nonce) as well as asymmetric ones (random padding). –  Maarten Bodewes Nov 16 '14 at 20:22