How does public key authentication work?