iOS Security SSL Pining part 2

Sagaya Abdulhafeez
3 min readDec 2, 2022

--

iOS security has long been a key focus for Apple, and one of the ways the company has sought to protect user data is through the use of SSL pinning. In this article, we’ll take a closer look at what SSL pinning is, how it works, and why it’s an important part of iOS security.

SSL, or Secure Sockets Layer, is a protocol used to encrypt data sent between a web server and a client, such as a web browser. This is important because it ensures that any sensitive information, such as passwords or financial data, remains private and cannot be intercepted by third parties.

SSL pinning is a technique that allows a client, such as an iOS app, to verify that the server it is communicating with is the one it is supposed to be communicating with. This is done by “pinning” the server’s SSL certificate to the app, so that the app only trusts communication from that specific server.

To understand how this works, it’s helpful to know a little bit about how SSL certificates work. When a server is set up to use SSL, it generates a unique SSL certificate that is signed by a trusted certificate authority (CA). This certificate contains information about the server, such as its domain name and its public key.

When a client, such as a web browser, connects to the server, the server sends its SSL certificate to the client. The client then uses the information in the certificate to verify the server’s identity, and if the certificate is valid, the client establishes an encrypted connection with the server.

SSL pinning takes this process a step further by “pinning” the server’s SSL certificate to the app. This means that the app will only trust communication from the specific server that it has been “pinned” to. If the app receives a certificate from any other server, it will not establish a connection, and the user will be alerted that there may be a problem.

There are a few different ways that SSL pinning can be implemented in an iOS app. The most common method is to embed the server’s SSL certificate directly into the app. This means that the certificate is included in the app’s code, and the app will only trust communication from the server whose certificate is embedded in the code.

Another method is to use a “public key pinning” approach, where the app is configured to trust only certain public keys. This means that even if the server’s certificate is changed, as long as the new certificate contains the same public key, the app will still trust the server.

Regardless of the specific implementation, the goal of SSL pinning is the same: to protect against “man-in-the-middle” attacks, where a third party intercepts communication between the app and the server and attempts to impersonate the server. By “pinning” the server’s SSL certificate to the app, SSL pinning makes it much more difficult for attackers to carry out these kinds of attacks.

In conclusion, SSL pinning is an important part of iOS security. By allowing apps to verify the identity of the servers they are communicating with, SSL pinning helps to protect against man-in-the-middle attacks and ensure that sensitive data remains private.

--

--