I'm trying to understand how public key authentication works and with tools such as ChatGPT I'm able to resolve how it works; the server keeps a tab of "authorized" public keys and uses them to authenticate clients. So what happens is that the server generates a so called "cryptographic challenge" which it encrypts with the public key. The client the decrypts the challenge, solves it and then sends the response back to the server.
But the question I'm unable to resolve is, why using the private key with the clients and not the other way around? I can see a viable solution where the public key instead is with the client and the private keys are kept in their secrecy with the server. In such a setup, the server could send something to the client whatever it may be and let the client encrypt the "challenge" and then use the private key to make sure that that message has been encrypted with an authorized key.
What is it that made them not go this route and consider this kind of solution less secure? The only thing I could think of is that if a server gets compromised and same key pairs are used for multiple servers it gets messier to clean it up. If you have the private key, you also implicitly have the public key as it can be generated from the private key with the standard PGP keys used with ssh today.
But are there other vulnerabilities that I have not considered?
But the question I'm unable to resolve is, why using the private key with the clients and not the other way around? I can see a viable solution where the public key instead is with the client and the private keys are kept in their secrecy with the server. In such a setup, the server could send something to the client whatever it may be and let the client encrypt the "challenge" and then use the private key to make sure that that message has been encrypted with an authorized key.
What is it that made them not go this route and consider this kind of solution less secure? The only thing I could think of is that if a server gets compromised and same key pairs are used for multiple servers it gets messier to clean it up. If you have the private key, you also implicitly have the public key as it can be generated from the private key with the standard PGP keys used with ssh today.
But are there other vulnerabilities that I have not considered?