There is something I do not get with public/private key authentification.
Let's take the example of using SSH communication between my PC and GitLab. I generate a pair of 2 keys, one private, one public. I can share the public one and give it to GitLab, and I keep the private one secret. The public is used to cypher a message, the private is used to decypher it.
So people (and in particular GitLab) can send me a cyphered message with the public key, and I can decypher it with my private key. That's cool, there is a one-directional communication, from GitLab to my computer. I am happy that GitLab can send me cyphered messages.
But on the other hand, I cannot send cyphered messages to people (and in particular GitLab) because they do not have a private key to decypher it. In such a case, how can SSH send cyphered messages from my PC to GitLab ? How can GitLab be sure that it is indeed me that is sending the message?
I have read something about "The private key is used to sign the message" but I do not understand it. Aren't private keys used only to decypher?
Thanks.
Actually, you've missed a few steps in SSH:
authorized_keys).