# Preserving Confidentiality and Integrity in a Public channel

Let's say I've got two people that are trying to talk in a public channel $A$ and $B$ and they want to preserve their confidentiality and integrity.

Which cryptographic algorithm would they want to use? Symmetric, or public key based? Also, what type of algorithm suites best and in what key size?

In my understanding, given the fact that the channel is public – and therefore considered unprotected – they will have to use public key first and send a symmetric key after that, thus securing the channel. Regarding key exchange they could use Diffie Hellman or RSA, and on symmetric key MAC.

Is this correct? Could they do it easier? Is there a safer way?

Which cryptographic algorithm would they want to use?

That will really depend on the situation. To select the algorithms one should ask himself (at least) the following questions:
Which standards do you trust? Which standard do you have to use? What computations can you afford?

Symmetric, or public key based?

It again depends on the situation. Usually you'll use a combination of both, however there are valid use-cases for using only public key cryptography (usually extremely short messages) and for using only symmetric cryptography, usually when performance is a constraint or when a shared secret has already been established (i.e. with embedded devices or in a session resumption scenario).

Also what type of algorithm suites best and in what key size?

The algorithms really depend on the situation given. Generally however, 128 - 256 bit symmetric encryption, 256 - 512 bit hash functions, 256 - 512 bit elliptic curves and / or 2048 - 4096 bit classical asymmetric cryptography (RSA, DSA, ...) is in use.

• Since it is public key, anyone can get it. So does an eavesdropper. Then he can also decrypt the symmetric key from the initial handshake. And then all subsequent communication is no secret. Is that an issue? – smwikipedia Sep 5 '18 at 2:51