pkyeck / socket.IO-objc

socket.io v0.7.2 — 0.9.x for iOS and OS X
MIT License
1.97k stars 439 forks source link

Added in SSL Certificate Pinning using RNPinnedCertValidator library #205

Open hongkongkiwi opened 10 years ago

hongkongkiwi commented 10 years ago

I've added SSL certificate pinning into the library, it relies on a new submodule RNPinnedCertValidator.

What is SSL pinning? It essentially adds an extra layer of security by checking a chain of trust against a local set of public certificate files (the files are stored in the bundle). This is useful to prevent Man in the middle attacks.

Here are some steps for setting up pinning in AFNetworking. The steps are the same to produce the cer file.

Once you have a .cer file, simply put it in your bundle and setup the library like this before connect

self.socketIO.useSSLPinning = YES;
self.socketIO.sslPinningCert = @"ca-file"; // Without the .cer extension

That's it!