1

So I have been reading about SSL pinning in context of a requirement where we have to interact with a web service operated by a partner of ours. We have an Android App and we would be making network calls to their service in a WebView(embedded web browser) and while SSL pinning has been labeled as the solution to verify identity really, I am still not clear on the fundamentals.

Say, I am interacting with Google. Firefox shows me their certificate details. If I were to be able to try out a MITM for a request to Google, can't I just copy Google's certificate(which seems to be a public information) and provide that as my certificate?

I don't see pinning help any identity cause. What have I left out of the story?

0

Say, I am interacting with Google. Firefox shows me their certificate details. If I were to be able to try out a MITM for a request to Google, can't I just copy Google's certificate(which seems to be a public information) and provide that as my certificate?

You can copy the certificate all you want, but you can't copy the private key that corresponds to the certificate. The private key is the (only) secret of the system, and closely guarded by the webserver.

The basic TLS handshake means that the server sends it's certificate, and proves it by using the corresponding private key to sign a nonce:

Server's digital signature: The server uses its private key to encrypt the client random, the server random, and its DH parameter*. This encrypted data functions as the server's digital signature, establishing that the server has the private key that matches with the public key from the SSL certificate.

Thus, when a client uses the certificate (the public key) to encrypt something, you have no way of decrypting it, and the TLS handshake will fail. This handshake normally happens before any data is exchanged.

You should probably read up on public key infrastructure which describes how the model works.

This is also why Heartbleed was a huge thing; it allowed extraction of the private keys from webservers.

| improve this answer | |
  • Fine. So, communication won't be trusted without TLS/SSL handshaking. I then should care for handshake only. How does pinning comes into picture? – Manish Kumar Sharma Nov 9 '19 at 13:30
  • Pinning basically means that you only except a limited set of certificates. So if a site pins CA Z, a (mis-)issued certificate from CA Y will not be permitted, or even limit it to a single public key, effectively barring anyone from using a substitute certificate. – vidarlo Nov 9 '19 at 14:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.