The answer to these questions is rather simple and can be explained with the image above. The lock in the image above has 2 keys, the public key, which can only turn counterclockwise, and a private key, which can only turn clockwise. We assume the public key of each lock is widely available.

Let’s say Alice wants to send an unencrypted message to Bob, but Bob wants to ensure Alice has sent the message. Alice puts the message in a box and then puts the lock on the box. She then locks the lock using her own private key (from B to C). After locking the box she sends it to Bob. Bob then receives the box and can verify the integrity (and sender) of the message using Alice’s public key. If Alice’s public key does not open the box the integrity of the message and box should be considered violated.

If you encrypt (“lock”) something with your private key, anyone can decrypt it (“unlock”), but this serves as a proof you encrypted it: it’s “digitally signed” by you. — Panayotis Vryonis

If Alice wants to send an encrypted message to Bob, and only Bob should be able to both decrypt the message and verify the identity of the sender, she would have to take some extra steps. First of all Alice puts the message in a box and puts a lock on the box, she then locks the box using her own private key (from B to C). She then puts the (locked) box in a new box and puts a new lock on the box. She locks the new lock using Bob’s public key (from B to A). After Alice is done she sends the box to Bob. Once Bob receives the box he can open the outer box with his private key, he can then open the inner box with Alice’s public key. If the inner box can not be opened with Alice’s public key the the integrity of the message and box should, yet again, be considered violated.

These ‘locks’ are called digital signatures.

Note that in reality both a signature generation algorithm, which takes a key and data, and a signature verification algorithm, which takes a message and signature, are needed to do the things explained above.

The usage in blockchains

While both asymmetric cryptography and digital signatures have been popular ever since they were invented, they are probably most known for their implementations in blockchains. Since blockchains are essentially widely distributed ledgers, it is of the essence that the cryptography used is both reliable and functional.

Most cryptocurrencies use keypairs (and thus asymmetric cryptography) to manage ‘addresses’ on the blockchain. The public key is the address, which ‘holds’ the tokens and it can be viewed by anyone. The private key is used to access the address and authorize actions for the ‘address’. Below is an example of an arbitrary address on the Ethereum blockchain.

Arbitrary Ethereum address

Digital signatures are also widely used in cryptocurrencies. They can be used to sign transactions more safely (offline) and are also used in multisignature contracts and wallets. These multisignature contracts and wallets require digital signatures from multiple (different) private keys before any action can be executed. For a more detailed explanation read this article.

These examples are just the tip of the iceberg though, as asymmetric cryptography has many more uses in blockchains, ranging from implementations in simple smart contracts to advanced permission structures, with many more exciting developments on the horizon.

About us

We are Blockgenic, a network of world class technology entrepreneurs and investors looking to make a positive impact on blockchain technology. You can find us here:

EOS Block Producer name: ‘blockgenicbp’

Website

Twitter

Youtube

Reddit

Written by Yannick Slenter for Blockgenic