Page Contents :
Digital Signature vs Encrypted Data
In the previous post, we discussed the purpose of public key cryptography , which is to encrypt information.
However, we didn’t elaborate further. In fact, the private key also can be used for encryption.
Private key encryption is used for digital signing of information. Only through the digital signature , the blockchain can confirm that you initiated the transaction and not someone else.
The digital signing is to attach a set of specific codes to information. This set of codes is obtained by using a hash function to convert the information into a hash value and encrypt it with a private key. It is used to identify the identity of the issuer, and therefore the recipient can use its matching public key to verify whether the information has been forged during transmission.
From here, we will see how public key cryptography is utilized.
In the first example, Bod uses Alice’s public key A to encrypt the sending message. So Alice can decrypt it with her private key A after receiving the message.
In the second example, Alice uses her private key A to sign the message. After receiving Alice’s message, Bod likewise can use Alice’s public key A to verify the signature, confirming that the message was sent by Alice.
The most important feature of a pair of public key and private key is that it can use to encrypt a message with public key or private key, yet the purpose of the two is unique.
The public key encryption process and the private key signing process are unique; similarly, the private key decryption and public key signature verification are also completely opposite.
Why Use Digital Signature
For the signing process, you only attach your digital signature to the message sent but do not encrypt the message.
So when the message is sent to the open network, not just the person you send to can read your message, even anybody on the open network can read your message.
So what’s the special meaning of doing this?
In the currently open network, all types of fake news are flooded. So what is the best approach to demonstrate that certain information is true and not false information sent by others arbitrarily?
In the event that you can use the public key to verify the source of the information, then you can verify that the information must come from the person who has the corresponding private key.
Although the digital signature only confirms the source of the information, it does not ensure the security of the information.
Nonetheless, in the present digital world or blockchain, this technique of safely confirming the source of information or transaction source undoubtedly addresses the important problems we face.
The Only True Source
Let’s take an example. George requested that Bod send him a 500-page legal document with a digital signature. In this way, George can confirm that this legal document was sent to him by Bod via the Internet and has not been tampered with by other Internet users.
The digital signing process is as per the following:
- First, Bod uses a hash function to hash the legal documents to be sent to obtain a small, fixed-length digest (or digital fingerprint).
- Bod uses his private key to encrypt the digest, that is, make a digital signature.
- Later, Bod added the original legal document and his digital signature together to form a signed document and sent it to George.
- After George received the signed document, he first decrypted the digital signature with Bod’s public key to obtain a digest.
- George uses the same hash function as Bod to hash the original document and obtain another new digest.
- George compares the hash values of the above two digests. If the hash values are equivalent, the signature is verified, which means that the file was sent by Bod.
Perhaps you might think that somebody may steal Bod’s private key and Impersonate Bob to send the file. However, this is a system security issue and is not part of our discussion.
Prevent Imitation
During the above file sending process, a third person in the open network might alter the file in some way during the sending.
Then, the hash value calculated by George on the file will not match the hash value decrypted with Bod’s public key, so George can be certain that this is not the original file sent by Bod.
On the off chance that a third person in the open network altered the file, attempt to create a replacement encrypted hash value or imitate the digital signature. Nonetheless, George could not decrypt with Bod’s public key, so George once again determined that this was not the original document sent by Bod.
The Power Of Hash Function
When digitally signing, we always apply a hash function to convert the files that require to be signed and get a digest. Even for few gigabyte files, we just need to sign this digest which is merely hundreds of bytes during a very short time, which shows the advantages of applying hash function conversion.
In blockchain transactions, we use an identical digital signature technique to verify whether the transaction item is initiated by the account owner.
Before we ending this post, let’s take a glance at a little magic show that is normally performed on the corner of the street.
After seeing the number from this third person, the magician will slowly tap the piece of paper with his magic stick to show that he could find the answer from here.
In fact, he tried to delay some time so that he could multiply the number 211 by 11 quickly.
Finally, the magician will write a number on a new piece of paper, which is the last 3 digits of the result of 211 multiplied by 11, and show it to the audience.
At this point, the young girl showed her paper to everyone. Both numbers in the papers are the same. Is it very amusing?
Wait, have you ever noticed something familiar?
Yes, the entire process is similar to how we use public key cryptography to encrypt.
We use the private key to encrypt and sign the digest, then use the public key to decrypt and verify the signature.
Having said that, do you feel that using public key cryptography for private key signing is that simple!
So in the next post, we will keep on to explore other blockchain knowledge.
Very good post. I absolutely appreciate this website. Stick with it!