2
$\begingroup$

I am confused in digital signature. what is use of encryption with private key and decryption with public key. Using public key we can decrypt the signature then what is use of private key privacy. Explain in detail.

$\endgroup$
4
$\begingroup$

When talking about digital signatures, the private key is what proves the authenticity of the signature, precisely because it is private.

The use case proceeds like this: I choose a private and public key pair. Because I chose it, only I know both keys. I then send a message and sign it by using my private key, typically by encrypting a digest, hash, or checksum of the message with the private key, so that it can only be decrypted with the matching public key.

I publish my public key for others to verify my signature with.

The receiver then manually computes the same digest of the message, decrypts the signature I sent along with it using my public key, and compares the two. If they are identical, the only way that is possible is if I am indeed the person who has the private key and published its matching public key. Otherwise, I would not have been able to properly sign the message without my private key.

This works because it is exceedingly difficult to compute the private key from the public key, so much so that it would take a very long time even on a supercomputer.

You might ask at this point, why is the signature an encrypted digest or hash of the message? If the message differs in any way (was tampered with or intercepted, as with a man-in-the-middle attack), the digest won't match whether it's decrypted correctly or not. So tampering with the message necessarily invalidates the signature, because it's a digest of the message itself, proving it's the same message sent by the person who signed it.

| improve this answer | |
$\endgroup$
2
$\begingroup$

"what is use of encryption with private key and decryption with public key"

The sender can sign a message with their private key (not encrypt it). This creates a signature, which is a blob with the message, to be sent with the message. The message is still in plaintext-> it is not encrypted and anyone can read it.

The purpose is to allow the receiver to authenticate, meaning to know without a doubt who the sender is.

You may ask yourself, why would I want to authenticate? Well, for just sending messages in emails, you might not want to use this function, and that's ok! But, just know that there computer systems that automatically use this authentication function, and they must, or they can easily be hacked. This includes TLS (the padlock in your browser).

Keep in mind, though, that this signing is not encrypting, although some documentation confuses people by saying it is.

| improve this answer | |
$\endgroup$
-1
$\begingroup$

I leave an example of RSA signature creation and verification process (note that other signature schemes will work in other way):

  • Sender computes the hash of the message that's going to be sent.
  • Sender signs the hash of that message with his private key. We call this signature a digital signature.
  • Senders sends to the receiver the message along with the digital signature and his public key.
  • Receiver verifies the digital signature deciphering it with sender's public key and obtains the original hash computed over the message.
  • Receiver computes the hash of the message and compares it with the obtained hash.

Now, if both hashes match then we know:

  • Message has not been altered or modified.

  • The message belongs to the sender since we have deciphered the digital signature with his public key, that means he signed it with his private key.

    Take a look at PGP. It is a mix of this scheme including symmetric-key encryption.

| improve this answer | |
$\endgroup$
  • $\begingroup$ 'Receiver verifies the digital signature deciphering it with sender's public key'; in general, this is wrong; not all digital signatures verify by having the verifier recover the original hash; in fact, about the only ones that do are RSA and Rabin. $\endgroup$ – poncho Nov 16 '16 at 14:56
  • $\begingroup$ Yes, you're right. I should have specified in my answer that the targeted cryptosystem is RSA. I am going to edit it now. $\endgroup$ – kub0x Nov 16 '16 at 15:03
  • $\begingroup$ I read that private key is used to encrypt the hash value because to avoid impersonate of sender . is it right $\endgroup$ – Arunkumar Topagi Nov 16 '16 at 16:19
  • $\begingroup$ The private key is used for signing. Public key for verification. If the verification is succesful then we know that the sender has not been impersonated since private and public keys are related. $\endgroup$ – kub0x Nov 16 '16 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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