Why did we call it digital signature if an attacker can pretend to be Bob?

Bob hashes his message, encrypts the hash with Alice's public key, and sends it to Alice with the original message. Alice receives that message and the signature. She decrypts the signature with her private key, and compares the outcome with the hash of the message.

But why did we call it a signature if a hacker can do what Bob has done?

A hacker can also hash his message, encrypt the hash with Alice's public key and send it to Alice. Sorry guys but digital signature seems similar to asymmetric encryption to me, a hacker can also pretend to be Bob.

  • $\begingroup$ Because in your example Bob would sign it with his private key. $\endgroup$
    – Modal Nest
    Dec 28, 2020 at 17:43
  • $\begingroup$ Don't mind all the down votes. This is perfect question that expressed what you did not understand. And stated well enough for someone to provide you with the answer you need in your understanding. $\endgroup$ Dec 29, 2020 at 11:50
  • 1
    $\begingroup$ @Finlay Weber: I disagree on "perfect question", because (a) It's presumptuous to seriously consider that a well-established concept (Digital Signature) is nonsense. (b) The error made is easily spotted by looking at a reference. [Update: what follows is now fixed] (c) The form is ambiguous (four uses of "it" refer to something the reader is left to redress: hash instead of message, cryptogram instead of key..) or wrong ("compares the original message with the signature"). (d) There are many grammar and typographic errors. (e) Poor tagging. $\endgroup$
    – fgrieu
    Dec 29, 2020 at 13:45
  • 2
    $\begingroup$ Then using the edit functionality to make suggestions that fixes issues you raised is way better (and friendlier) than just down votes. $\endgroup$ Dec 29, 2020 at 14:13
  • 1
    $\begingroup$ ok, I agree might not be the perfect question and downvoting also does not help much $\endgroup$ Dec 29, 2020 at 16:20

3 Answers 3


bob hashes his message and encrypt it with alice public key

No, Bob would sign it with his own private key. For some signature methods, this is roughly similar to "encrypting with the private key", however for other signature methods, it's not; hence it is safer to keep a strong distinction between 'signing' and 'encrypting'

alice receives the original message and the signature she decrypts the signature with her private key and she compares the original message with the signature

No, Alice would validate the signature with Bob's public key. How Alice gets a verified copy of Bob's public key is an important part of this process, however that is generally considered something to be solved by the whatever mechanism is using the signature method.

Why did we call it digital signature if an attacker can pretend to be bob?

If the attacker does not have Bob's private key (and so he cannot generate sigantures that would verify with Bob's public key), and he can't fool Alice into using the attack's public key, the attacker cannot pretend to be Bob.


Sorry for the downvotes, some users in the community can be toxic sometimes. Anyway, a digital signatures (decryptable, like in RSA or not like in DSA variants) are something that can only be created using a private key and verified using a public key using some very clever mathematics with decades of scrutiny. Hope this helps.


Digital signatures take place in reverse from asymmetric encryption.

In asymmetric encryption if Bob wants to send a message to Alice, Bob will take Alice's public key, use it to encrypt his data, and then send that to Alice. Which of course only Alice can decrypt because she is the only owner of her private key.

In digital signatures, Bob takes an agreed message, "encrypts it" with his private key, and sends it to Alice. It's easy for Alice to decrypt this with Bob's public key and determine that only the owner of Bob's private key could have sent the message in the first place. If we (like we did earlier) assume that Bob is the only owner of his private key, then we can say that Bob has "signed" the message.

  • 1
    $\begingroup$ "Bob will take Alice's public key, use it to encrypt his data"; please don't use that terminology to talk about signature methods in general. If you don't look that closely, that could sort-of describe RSA, and arguably Rabin and Multivariate signatures. However, it doesn't come anywhere close to describing DSA (or ECDSA), BLS, lattice based signatures, hash based signatures or Picnic... $\endgroup$
    – poncho
    Dec 30, 2020 at 3:08
  • $\begingroup$ The asker of the question seemed to be completely unclear on how to differentiate digital signatures from asymmetric encryption (had they known how to differentiate it, they wouldn't have mixed up the order of public key vs private key in their question). I feel like this answer cut to the heart of the matter, even if it is (as you correctly noted) very specialized for RSA-like cryptosystems $\endgroup$ Dec 30, 2020 at 5:30
  • $\begingroup$ Once they wrap their head around one cryptosystem makign the jump for the next becomes a lot easier. Its less important to be correct in all instances, than to be maximally useful to the poster. I am obviously not some objective judge of utility but this is my attempt at making what I thought would be useful to them. $\endgroup$ Dec 30, 2020 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.