According to image 1, for two way communication, each person needs to generate a pair of keys. However, according to image 2, only one pair of keys is required for two way communication. Thanks to anyone who can settle my confusion.

Source 1

If a two-way communication is required between all five workers, then they all need to generate their own matching public and private keys. Once this is done, all users then need to swap public keys so that they can send encrypted documents, files or messages between each other. Each worker will then use their own private key to decrypt information being sent to them.

Source 2

the other key is known as the private key. Data encrypted with the public key can only be decrypted with the private key, and data encrypted with the private key can only be decrypted with the public key. Public key encryption is also known as asymmetric encryption. It is widely used, especially for TLS/SSL, which makes HTTPS possible.

  • 2
    $\begingroup$ Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe the text. $\endgroup$
    – D.W.
    Commented Feb 5, 2020 at 16:53
  • $\begingroup$ I believe you now mean 'source 1' and 'source 2'. If true, please edit the question. $\endgroup$
    – ndemarco
    Commented Aug 4, 2021 at 18:05
  • $\begingroup$ Please provide a full reference for your sources. We expect references to fulfill the minimal scholarly requirements and be as robust over time as possible. Please take some time to improve your post in this regard. We have collected some advice here. Thank you! $\endgroup$
    – D.W.
    Commented Jan 10, 2022 at 0:25

2 Answers 2

  1. Source

We don't use public-private keys to encrypt files or documents. We use public-key cryptography for hybrid encryption or digital signatures.

Examples of Hybrid encryption.

  • RSA as Key Encapsulation Mechanism (KEM)) and AES-GCM as Data Encapsulation Mechanism (DEM). This composition of a KEM and a DEM (data encapsulation mechanism; an authenticated cipher serves as a DEM) provides the standard of IND-CCA2/NM-CCA2—ciphertext indistinguishability and nonmalleability under adaptive chosen-ciphertext attack. That is the minimum requirement for modern Cryptography. See the detail, here

  • Similarly, one can achieve with Diffie-Hellman key exchange (DHKE). Two-party exchange keys by the DHKE and generate the sessing key by using a Key Derivation Function. And with the derived key, we use a modern mode of operation like AES-GCM or ChaCha20-Poly1305. Both are Authenticated Encryption modes that provide us with Confidentiality, Integrity, and Authentication.

  • With libsodium you can start to use crypto_box_curve25519xsalsa20poly1305. Based on Elliptic Curver DHKE: Curve X25519, Encryption: XSalsa20 stream cipher, Authentication: Poly1305 MAC.

Digital signatures:

  • Here only warn about the common mistake on RSA. RSA decryption is not signature. RSA signature requires special padding RSA-PSS and using the same RSA setup for encryption and signature is not advised.
  1. Source

It tells almost nothing about the TLS,

According to image 1, for two way communication, each person needs to generate a pair of keys. However according to image 2, only one pair of keys is required for two way communication. Thanks to anyone who can settle my confusion.

Source 2 only talk about public-private key usage. However, there is a misconception there. You don't encrypt with your private key. The sole purpose of encryption is confidentiality. Your public key is public, so everybody can use your public key to decrypt the message encrypted with your private key!

To send an encrypted message to you, you either share a common secret key with the other party - that we don't prefer - or have a private and public key pair. With this pair, once you publish your public key, everybody can send you a message, even anonymously. If you don't want anonymous messages, then the other site must have a public-private key which you know the public key belongs to them. Rest, use a hybrid cryptosystem as above.

The 2. source only talk about in this way, explicitly they are talking the same. Each user at least one public-private key and distribute their public key. Of course, you may need a Certificate Authority to prove the ownership of the public key.

  • $\begingroup$ Is there a difference between key encapsulation in hybrid encryption, and data signatures? $\endgroup$
    – Dylan
    Commented Feb 9, 2020 at 14:08
  • $\begingroup$ A digital signature is a different subject. Why do you think that there is a relation? $\endgroup$
    – kelalaka
    Commented Feb 9, 2020 at 14:10
  • $\begingroup$ They both use assymetric encryption to provide authentication $\endgroup$
    – Dylan
    Commented Feb 9, 2020 at 14:13
  • $\begingroup$ It is not key encapsulation that provides authentication there, It is GCM that provides authentication of the message and that is performed with the shared key. The authentication that comes from the Digital signatures is unique to the sender. $\endgroup$
    – kelalaka
    Commented Feb 9, 2020 at 14:24
  • $\begingroup$ Assymetric encryption handles the key encapsulation and key exchange part of hybrid encryption. These parts provide confidentiality. Symmetrical encryption handles the data encapsulation and data exchange in hybrid encryption, the GCM within symmetrical encryption provides authentication. Is this correct? $\endgroup$
    – Dylan
    Commented Feb 9, 2020 at 15:06

The first source is being imprecise when they say "need". What they mean is that this is one way to accomplish it.

The second source doesn't say what you claim it says.

I suggest studying key exchange protocols and learning how SSL works.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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