Click here to Skip to main content
14,427,367 members
Rate this:
Please Sign up or sign in to vote.
See more:
Afternoon all,

I;ve created a simple app using a webservice and now I want to secure it using a third party SSL. I already have the SSL installed and working on my webservice, now I want my iOS project to connect but I can't figure out how. I've already successfully connected and downloaded to webservice using two different methods just so I can get a decent understanding. NSURLCONNECTION and AFHTTPSESSIONMANAGER. Both work to return the same results.

Now I've been reading different posts on using SSL with those methods. It seems I should install (pin) the public certificate to my app. Below is some code I found to use as a guide. My first question with this is how/where do I get the file to drag into my xcode project. (note I am using Microsoft azure web service)
I went to where I purchased the third party certificate and I can download something there... seems to be two different files... and one is intermediate. Are these the files I am supposed to pin? I also read there is a way to grab them right from my server but I don't know how?

Any ideas?
thanks in advance!

+ (AFSecurityPolicy*)customSecurityPolicy {
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFsslPinningModeNone];
NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"der"];
NSData *certData = [NSData dataWithContentsOfFile:cerPath];
[securityPolicy setAllowInvalidCertificates:NO];
[securityPolicy setValidatesCertificateChain:NO];
[securityPolicy setPinnedCertificates:@[certData]];
return securityPolicy;
}
Posted
Updated 8-Mar-17 21:19pm
Comments
Member 13047714 9-Mar-17 23:42pm
   
Did you find any solution? I am also implementing SSL pinning in IOS. But cant understand how to do it? If you have the solution kindly post it with sample code. I am also using AFnetworking for objective c

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Did you find any solution? I am also implementing SSL pinning in IOS. But cant understand how to do it? If you have the solution kindly post it with sample code. I am also using AFnetworking for objective c
   
Comments
Richard Deeming 9-Mar-17 11:02am
   
If you want to ask the OP for clarification, then click the "Have a Question or Comment?" button under the question to add a comment.

If you want to ask a new question, then ASK A QUESTION[^].

DO NOT post your question as a "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,103
Richard MacCutchan 1,804
phil.o 1,270
Patrice T 1,187
MadMyche 1,100



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100