Skip to main content

Unblocking the Blockchain: Public-Key Cryptography

Heng Kiong teaches information technology, including business analytics and management information systems, at a tertiary institute.

Private-Key Cryptography Versus Public-Key

An earlier article explored how symmetric key algorithm or private-key cryptography works. We learned that there are challenges with using the same private key to encrypt and decrypt data. These are summarised below:

1. How do we ensure that the private key is exchanged over a secure channel?
2. An encrypted message may be stolen and decrypted by anyone who has access to the private key.
3. How do we trust the identify of the other party receiving the message?
4. How do we trust that the message is from the sender, since the recipient is also having the same private key?
5. The sender has to keep track of multiple keys when sending multiple messages.

Public-Key Cryptography

Blockchain uses public-key cryptography which is an encryption based upon asymmetric key algorithms. public-key cryptography uses two keys instead of one to encrypt and decrypt data.

To explain further, let's use the same example from the previous article. This time, however, A sends a lock to B instead of the private key. The lock is the public key, and known to all. Whoever wishes to send a message to A uses the lock belonging to A to secure the message. A then uses the private key to unlock the message.

Public-key Cryptography Explained Using Colours

Let us now look at public-key cryptography with the help of colours.

B uses A's public key to encrypt a message before sending to A.

Only A is able to receive this message using his own private key.

And Vice-versa ...

A wishes to send a message to B.

A uses his own private Key to encrypt the message before sending.

B uses A's public key to decrypt the message. This shows that the message originates from A, and nobody else.

Public-key cryptography clearly offers better security compared to using symmetric-key cryptography as described in the previous article.

Two different keys are used for encryption and decryption of messages for communications.

In Blockchain applications, digital signatures based upon public-key cryptography are implemented using mathematic algorithms. A pair of public and private keys are generated. Just like what you saw in the colour examples above, this pair of keys are mathematically related. So only the public key can decrypt what the private key has encrypted and vice versa. The chance that an eavesdropper (or hacker) can derive the private key from a given public key (or vice-versa) is very small.

Scroll to Continue

Another article I have written explains more about mathematical formulas that can be used to implement the public-key cryptography technique used in Bitcoin and Blockchain.

For the rest of us who are not so keen on the explanation of how the public and private Keys are related mathematically, below is a diagram showing how a plaintext has been encrypted and decrypted using public-key cryptography formulae.

Quiz

For each question, choose the best answer. The answer key is below.

1. Only the Public Key is known to the Public. The Private key is secret and kept with the Sender.
• True
• False

1. True

What's Next?

As mentioned earlier, digital signatures used in blockchains are based on public-key cryptography. In blockchain, users on the nodes need assurance that the records are non-repudiatable to avoid disputes.

We will be talking about the model of digital signature schema in the next article.

Article Navigation

Check out the full series:

Part 1 - What is Blockchain?

Part 2 - Centralised vs. Decentralised Databases

Part 3 - Digital Signatures

Part 4 - Private-key Cryptography

Part 5 - Public-key Cryptography

Part 6 - Cryptography and Digital Signatures

Part 7 - Hashing

This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.

© 2018 Heng Kiong Yap