I have a simple question,

When I sign a message (in RSA) does the program encrypt the text with my private key?

Because I can decrypt it with my public key.

Yes or no. Is signing a message just encrypting with private key?

  • $\begingroup$ I marked this as a duplicate. If you feel that was incorrect, please update your question to state the difference in what you are asking vs what was asked/answered in the other question (and its answers). $\endgroup$ – mikeazo Jan 27 '15 at 17:48
  • 1
    $\begingroup$ No, proper RSA signing of a text is not as simple applying the private-key function to the (hash of a) text ("encrypting a text with private key" as questionably worded in the question). $\;$ That is not safe for many definitions of safe, including most ones used in cryptography. $\;$ For an introduction to that, see the second part of this answer, and the final reference. $\endgroup$ – fgrieu Jan 27 '15 at 17:53
  • 1
    $\begingroup$ Also, if you're not talking about RSA, but instead talking about, say, DSS or ECDSA, 'signing by encrypting' is not at all accurate, even as an oversimplification. $\endgroup$ – poncho Jan 27 '15 at 18:22
  • $\begingroup$ To expand on what Poncho said, with algorithms like DSA (variants of which are used in DSS and ECDSA) "encrypting with the private key" doesn't even make sense: the algorithms aren't encryption algorithms, aren't similar to any encryption algorithm, and you can't do anything approximating "decrypting" the signature (signature verification instead looks like "Using the message and signature, compute these values with these operations and check that this equation holds;" the operations in question are not reversible, so you can't recover the message hash from the signature) $\endgroup$ – cpast Jan 28 '15 at 4:26