<blockquote>
<p><strong>What am I understanding wrongly?</strong></p>
</blockquote>
<p>You are mixing up several distinct uses of cryptography, several different purposes:</p>
<ul>
<li>authentication</li>
<li>non-repudiation</li>
<li>privacy</li>
<li>proof of integrity</li>
</ul>
<h1>Cryptography in General</h1>
<h2>Purposes</h2>
<h3>Privacy</h3>
<p>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.</p>
<p>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.</p>
<h3>Authentication</h3>
<p>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.</p>
<h2>Types of Encryption</h2>
<h3>Assymetric</h3>
<p>Asymmertic means you use different keys for encrypting and decrypting. There is both a private key and a public key. hence the name &quot;public-key cryptography&quot;.</p>
<h3>Symmetric</h3>
<p>By contrast, an example of a <em>symmetric</em> (not asymmetric) algorithm is <a href="https://en.wikipedia.org/wiki/Data_Encryption_Standard" rel="nofollow noreferrer">DES</a> 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 &quot;secret-key&quot; - hence the names &quot;secret-key cryptography&quot; or &quot;shared-key cryptography&quot;.</p>
<hr />
<h1>Cryptography in Bitcoin</h1>
<p>From what I've read, Bitcoin uses</p>
<ul>
<li>Hash algorithms
<ul>
<li><a href="https://en.wikipedia.org/wiki/SHA-2" rel="nofollow noreferrer">SHA-256</a> for proof of work</li>
</ul>
</li>
<li>Digital signatures
<ul>
<li><a href="https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm" rel="nofollow noreferrer">ECDSA</a> for signatures on transactions</li>
</ul>
</li>
</ul>
<p>Note that ECDSA is asymmetric</p>
<p>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 <em>Wallet software</em> might use encryption to hide your secret keys behind a password - but that is not part of the BitCoin spec.</p>
<hr />
<h2>References</h2>
<ul>
<li><a href="https://bitcoin.org/bitcoin.pdf" rel="nofollow noreferrer">Satoshi Nakamoto, Bitcoin Whitepaper</a>. Sections 2 and 4.</li>
<li><a href="https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm" rel="nofollow noreferrer">Bitcoin Wiki, ECDSA</a></li>
</ul>

CC BY-SA 4.0
2018-05-02T19:24:34.000Z
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
CC BY-SA 4.0
2018-05-02T21:47:35.927Z
@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 https://en.bitcoin.it/wiki/How_bitcoin_works "public-key cryptography" is another name for "asymmetric encryption". See https://en.wikipedia.org/wiki/Public-key_cryptography
RedGrittyBrick
CC BY-SA 4.0
2018-05-02T13:59:25.907Z
2018-05-02T22:32:30.903Z
2020-06-16T11:10:03.350Z
RedGrittyBrick
<p>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 <strong>authentication</strong> scheme.</p>

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

<p>They have different purposes. Don't let them confuse you.</p>

CC BY-SA 4.0
2018-05-02T13:55:57.657Z
2018-05-02T13:55:57.657Z
MCCCS
<p>The two articles are talking about two very different things.</p>

<p>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.</p>

<p>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.</p>

CC BY-SA 4.0
2018-05-02T22:33:37.897Z
2018-05-02T22:33:37.897Z
Meni Rosenfeld
<p>I am relatively new to cryptography and blockchain and am learning about how public key cryptography works, and its application in Bitcoin's environment.</p>

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

<p>From the 1st article (<a href="https://www.blockchain-council.org/blockchain/how-does-blockchain-use-public-key-cryptography/" rel="nofollow noreferrer">https://www.blockchain-council.org/blockchain/how-does-blockchain-use-public-key-cryptography/</a>), 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. </p>

<p>However,a 2nd article I read (<a href="https://www.ibm.com/support/knowledgecenter/en/SSB23S_1.1.0.14/gtps7/s7pkey.html" rel="nofollow noreferrer">https://www.ibm.com/support/knowledgecenter/en/SSB23S_1.1.0.14/gtps7/s7pkey.html</a>) 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:</p>

<p><img src="https://www.ibm.com/support/knowledgecenter/SSB23S_1.1.0.14/gtps7/ssldig02.gif" alt=""></p>

<p>What am I understanding wrongly? Why is the use of keys in opposite order?</p>

<p>Thank you in advance for your input...</p>

<transactions><private-key><public-key><signature><cryptography>
Public key cryptography question - Is Private or Public key used to sign? Confusion between which key is used to sign and which is used to encrypt
DCH
# Public key cryptography question - Is Private or Public key used to sign? Confusion between which key is used to sign and which is used to encrypt

(Asked by: username_0 on 2018-05-02)

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:

![](https://www.ibm.com/support/knowledgecenter/SSB23S_1.1.0.14/gtps7/ssldig02.gif)

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

Thank you in advance for your input...

**Tags:** transactions, private-key, public-key, signature, cryptography


---

## 3 answers

### Answer by username_1 on 2018-05-02. Score: 3 | Accepted answer

> **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](https://en.wikipedia.org/wiki/Data_Encryption_Standard) 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
  + [SHA-256](https://en.wikipedia.org/wiki/SHA-2) for proof of work
* Digital signatures
  + [ECDSA](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm) 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

* [Satoshi Nakamoto, Bitcoin Whitepaper](https://bitcoin.org/bitcoin.pdf). Sections 2 and 4.
* [Bitcoin Wiki, ECDSA](https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm)

> **Comments:**
> **username_0**: so Bitcoin uses the 'Authentication' method you mentioned correct? and not the 'Privacy' Method. The other response to this question by username_2 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!  
> **username_1**: @username_0: 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 https://en.bitcoin.it/wiki/How_bitcoin_works "public-key cryptography" is another name for "asymmetric encryption". See https://en.wikipedia.org/wiki/Public-key_cryptography  

---

### Answer by username_2 on 2018-05-02. Score: 0

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.


---

### Answer by username_3 on 2018-05-02. Score: 0

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.


---

