I need to create a client library to talk to a single service (say google.com) over HTTPS. I would like the library to ship with all data (a certificate or a key) needed to authenticate the service.
I'm confused what this data should be. Should it be a public key of a certificate authority that signed google.com certificate? Or should it be google.com public key?
In all examples I've seen, the certificate authority's public key is used to authenticate a connection. But it seems unnecessary. If my library talks only to google.com, can I obtain and save google.com public key over secure channel (a browser) and then use this key directly to establish authenticated connections without using CA key again?