I am relatively new to cryptography and blockchain and am learning about how public key cryptography works, and its application in Bitcoin's environment.

I read two different articles , the 1st which made sense, but the 2nd confused me.

From the 1st article (https://www.blockchain-council.org/blockchain/how-does-blockchain-use-public-key-cryptography/), I understand that the sender's private key is used to sign the digital transaction and the sender's public key is used by the miner/receiver to verify the senders signature.

However,a 2nd article I read (https://www.ibm.com/support/knowledgecenter/en/SSB23S_1.1.0.14/gtps7/s7pkey.html) about public key cryptography has it the other way around; using Public key first then the private key after. I have attached the picture from the 2nd link:

What am I understanding wrongly? Why is the use of keys in opposite order?

Thank you in advance for your input...

up vote 2 down vote accepted

What am I understanding wrongly?

You are mixing up several distinct uses of cryptography, several different purposes:

  • authentication
  • non-repudiation
  • privacy
  • proof of integrity

Cryptography in General

Purposes

Privacy

If you want to send a private message to someone, in a way that no-one intercepting the message can read it, you typically encrypt the message using a symmetric (secret-key) algorithm and a newly created secret-key. You then encrypt the secret-key using the intended recipient's public key. This ensures that only the intended recipient can decrypt the secret-key for the message by using their private key (which no one else knows). After decrypting the secret key, the intended recipient is able to decrypt the message using the symmetric algorithm.

Note that you only use a symmetric algorithm to encrypt the message because such algorithms are far far faster than asymmetric (public-key) algorithms. It is primarily for efficiency, not for any other reason.

Authentication

If you want to send a message to someone and provide proof that you sent the message, you use a different procedure. You create a cryptographic hash of the message using a hashing algorithm. You then encrypt that hash with your private key (that only you know). The encrypted hash is sent with the message. This encrypted hash is known as a digital-signature. The recipient of the message can use your public key to extract the hash and compare that with a freshly computed hash of the message, if the hashes match it is proof that you sent the message.

Types of Encryption

Assymetric

Asymmertic means you use different keys for encrypting and decrypting. There is both a private key and a public key. hence the name "public-key cryptography".

Symmetric

By contrast, an example of a symmetric (not asymmetric) algorithm is DES which is a symmetric encryption algorithm because there is only one key, the same key is used for both encrypting and decrypting. The key is a shared "secret-key" - hence the names "secret-key cryptography" or "shared-key cryptography".


Cryptography in Bitcoin

From what I've read, Bitcoin uses

  • Hash algorithms
  • Digital signatures
    • ECDSA for signatures on transactions

Note that ECDSA is asymmetric

Note also that Bitcoin cares about anonymity and not about privacy (the blockchain is public not private). Therefore Bitcoin does not use encryption for privacy purposes. Your Wallet software might use encryption to hide your secret keys behind a password - but that is not part of the BitCoin spec.


References

  • so Bitcoin uses the 'Authentication' method you mentioned correct? and not the 'Privacy' Method. The other response to this question by MCCCS states 'asymmetric encryption' is not used by Bitcoin; but your response suggests that 'we create a cryptographic hash of the message'. Not sure if im overthinking this! – DCH May 2 at 19:24
  • @DCH: The algorithm used for a cryptographic hash is a "one-way" or "trapdoor" algorithm, not an encryption algorithm. Asymmetric encryption is used to create digital signatures. See en.bitcoin.it/wiki/How_bitcoin_works "public-key cryptography" is another name for "asymmetric encryption". See en.wikipedia.org/wiki/Public-key_cryptography – RedGrittyBrick May 2 at 21:47

The first article is about how Bitcoin signs (the hash of) data to prove ownership (and to spend) coins. There's nothing encrypted, it's used as an authentication scheme.

The second article is about asymmetric encryption. It's for encrypting data, not for authentication. It's not what Bitcoin uses. (See also: ECIES)

They have different purposes. Don't let them confuse you.

The two articles are talking about two very different things.

The 1st article is about digital signatures, which are used to prove that someone has written a message and was not impersonated. These are used extensively in Bitcoin. The sender of the message uses his own private key to sign, the receiver uses the sender's public key to verify that the signature is authentic.

The 2nd article is about encryption, which is used to hide the contents of a message from everyone but the intended recipient. This is not used in Bitcoin at all. In places where it is used, the sender uses the receiver's public key to encrypt, and the receiver uses his own private key to decrypt and gain access to the information.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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