Generally, SSL certificate used to verify the security level of a website/URL. In the SSL handshake method, Client verifies the website/application certificate with the authorized public CA or where the respective certificate got issued.
If the certificate got verified by the trusted certificate authority then the connection opens and data transfer in a secure manner.
Also Read SSL/TLS Certificate Revocation is Broken
Why Certificate Pinning Need?
Even though the digital certificate authentication is secure the hacker can launch “Man In Middle Attack” which breaks the security by authenticating the CA public certificate using hacked digital certificate.
The hacker inject their security certificate in our environment to make authenticate the Application/URL. Once it’s done they can easily track the secure encrypted communication like user name and password.
So in that scenario, we are not able to predict security level of certificate verification process, To overcome that we can prefer the method called “Certificate Pinning”.
What is Certificate Pinning?
Certificate pinning is a safe security measure to avoid the Man In Middle Attack of secure HTTPS connection. The method of pinning our trusted known certificate along with its fingerprint /serial number in a trusted store is called Certificate Pinning.
Mostly it is applied in mobile application or any other application software only. This avoids the fake certificate authorization process.
The above diagram shows the Certificate Pinning process, that slightly differs from the normal HTTPS handshake process. Pinning is making sure the client checks the server’s certificate against a known copy of that certificate.
Simply bundle your server’s secure certificate inside your application, and make sure any HTTPS/Secure request first validates that the server’s certificate exactly matches the bundle’s certificate.