Member-only story

SSL Pinning in iOS

Certificate Pinning and Public Key Pinning

6 min readDec 15, 2021

Before start about Pinning we should know why we need it?

The answer is, we need it to prevent man-in-the-middle attack. SSL Pinning prevents a man-in-the-middle attack, which means an attacker can not intercept the traffic and modify the data. If an attacker can not intercept the traffic then the application automatically prevents many server-side vulnerabilities. That’s why implementing SSL is very important. Let’s learn about man-in-the-middle attack.

Man-In-The-Middle Attack

A man-in-the-middle is an attack is a cyberattack where the attacker secretly listens and eventually alters the communication between two parties who believe they are directly communicating with each other.

Attacker gain access to a user’s personal data or the data of some resource a user accesses such as banking data, user credentials, photos, documents, and messages.

Fortunately, there’s a simple way to prevent this kind of attack through a technique called SSL Pinning.

SSL Pinning

SSL Pinning is a technique that is used on the client-side to avoid a man-in-the-middle attack by validating the expected X509 certificate or public key.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Mohammad Mahmudul Hasan

Written by Mohammad Mahmudul Hasan

A learner, constantly striving to learn new technologies and look the ways to be better in this rapidly changing industry.

Responses (7)

Write a response

How does this version of public key hash pinning compare to using App Transport Security’s built-in version? https://developer.apple.com/documentation/bundleresources/information_property_list/nspinnedcaidentities

2

The way it calcuate the sha256 doesn't work anymore. I found a solution: https://github.com/zhouhao27/SSLPinningTest

1

very deeply and properly explained the process and implementation here. Really appreciated