iOS Swift Pin PEM Certificate to Run REST POST RequestiOS certificate pinning with Swift and NSURLSessionAFNetworking Post RequestSend POST request using NSURLSessionRestKit 0.20.3 Incomplete initialisation with certificateHow to make an HTTP request in Swift?Problems with SSL Pinning and AFNetworking 2.5.0 (NSURLErrorDomain error -1012.)SSL Pinning with AFNetworking - validatesCertificateChain = trueHow to send a POST request with BODY in swiftAFNetworking problems with TLS Verification of a self signed server root CAGetting client certificate to work for mutual authentication using Swift 3 and Alamofire 4Two certificates Alamofire iOS

How can I improve my formal definitions?

awk print conditions

Could a simple hospital oxygen mask protect from aerosol poison?

How smart contract transactions work?

How to differentiate between two people with the same name in a story?

In what language did Túrin converse with Mím?

A vector is defined to have a magnitude and *a* direction, but the zero vector has no *single* direction. So, how is the zero vector a vector?

What caused the end of cybernetic implants?

Calculate Landau's function

Can a system of three stars exist?

Is there anything in the universe that cannot be compressed?

Can authors email you PDFs of their textbook for free?

How would a disabled person earn their living in a medieval-type town?

Four day weekend?

What are ways to record who took the pictures if a camera is used by multiple people?

Heuristic argument for the Riemann Hypothesis

When you have to wait for a short time

Padding a column of lists

Moscow SVO airport, how to avoid scam taxis without pre-booking?

Ideas behind the 8.Bd3 line in the 4.Ng5 Two Knights Defense

Does Q ever actually lie?

Properly unlinking hard links

In Toy Story, are toys the only inanimate objects that become alive? And if so, why?

Break down the phrase "shitsurei shinakereba naranaindesu"



iOS Swift Pin PEM Certificate to Run REST POST Request


iOS certificate pinning with Swift and NSURLSessionAFNetworking Post RequestSend POST request using NSURLSessionRestKit 0.20.3 Incomplete initialisation with certificateHow to make an HTTP request in Swift?Problems with SSL Pinning and AFNetworking 2.5.0 (NSURLErrorDomain error -1012.)SSL Pinning with AFNetworking - validatesCertificateChain = trueHow to send a POST request with BODY in swiftAFNetworking problems with TLS Verification of a self signed server root CAGetting client certificate to work for mutual authentication using Swift 3 and Alamofire 4Two certificates Alamofire iOS






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I've been trying to use Alamofire to pin a PEM certificate using these methods:



  • SSL pinning in iOS - Swift edition

  • Adding certificate pinning to your iOS app with Alamofire

I've also tried using AFNetworking:



NSData *certificateData = [NSData dataWithContentsOfFile:certificatePath];
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef) certificateData);
NSArray *arr = [[NSArray alloc] initWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(cert), nil];
[securityPolicy setPinnedCertificates:arr];


Most of the time I will get -999 and -1012 errors. When running a curl command, it works as it should. However, it does not seem to work when converting the PEM certificate to a DER format.










share|improve this question


























  • Hi could you please give me some more details to understand. The code is in objective c, do you want to have it in swift or objective c.

    – maheswaran
    Apr 4 at 10:32











  • Try this stackoverflow.com/questions/34223291/…

    – maheswaran
    Apr 4 at 18:49

















0















I've been trying to use Alamofire to pin a PEM certificate using these methods:



  • SSL pinning in iOS - Swift edition

  • Adding certificate pinning to your iOS app with Alamofire

I've also tried using AFNetworking:



NSData *certificateData = [NSData dataWithContentsOfFile:certificatePath];
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef) certificateData);
NSArray *arr = [[NSArray alloc] initWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(cert), nil];
[securityPolicy setPinnedCertificates:arr];


Most of the time I will get -999 and -1012 errors. When running a curl command, it works as it should. However, it does not seem to work when converting the PEM certificate to a DER format.










share|improve this question


























  • Hi could you please give me some more details to understand. The code is in objective c, do you want to have it in swift or objective c.

    – maheswaran
    Apr 4 at 10:32











  • Try this stackoverflow.com/questions/34223291/…

    – maheswaran
    Apr 4 at 18:49













0












0








0








I've been trying to use Alamofire to pin a PEM certificate using these methods:



  • SSL pinning in iOS - Swift edition

  • Adding certificate pinning to your iOS app with Alamofire

I've also tried using AFNetworking:



NSData *certificateData = [NSData dataWithContentsOfFile:certificatePath];
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef) certificateData);
NSArray *arr = [[NSArray alloc] initWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(cert), nil];
[securityPolicy setPinnedCertificates:arr];


Most of the time I will get -999 and -1012 errors. When running a curl command, it works as it should. However, it does not seem to work when converting the PEM certificate to a DER format.










share|improve this question
















I've been trying to use Alamofire to pin a PEM certificate using these methods:



  • SSL pinning in iOS - Swift edition

  • Adding certificate pinning to your iOS app with Alamofire

I've also tried using AFNetworking:



NSData *certificateData = [NSData dataWithContentsOfFile:certificatePath];
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef) certificateData);
NSArray *arr = [[NSArray alloc] initWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(cert), nil];
[securityPolicy setPinnedCertificates:arr];


Most of the time I will get -999 and -1012 errors. When running a curl command, it works as it should. However, it does not seem to work when converting the PEM certificate to a DER format.







ios objective-c swift alamofire afnetworking






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 8 at 11:16









muru

3,50718 silver badges57 bronze badges




3,50718 silver badges57 bronze badges










asked Mar 27 at 23:52









sonics876sonics876

6751 gold badge12 silver badges26 bronze badges




6751 gold badge12 silver badges26 bronze badges















  • Hi could you please give me some more details to understand. The code is in objective c, do you want to have it in swift or objective c.

    – maheswaran
    Apr 4 at 10:32











  • Try this stackoverflow.com/questions/34223291/…

    – maheswaran
    Apr 4 at 18:49

















  • Hi could you please give me some more details to understand. The code is in objective c, do you want to have it in swift or objective c.

    – maheswaran
    Apr 4 at 10:32











  • Try this stackoverflow.com/questions/34223291/…

    – maheswaran
    Apr 4 at 18:49
















Hi could you please give me some more details to understand. The code is in objective c, do you want to have it in swift or objective c.

– maheswaran
Apr 4 at 10:32





Hi could you please give me some more details to understand. The code is in objective c, do you want to have it in swift or objective c.

– maheswaran
Apr 4 at 10:32













Try this stackoverflow.com/questions/34223291/…

– maheswaran
Apr 4 at 18:49





Try this stackoverflow.com/questions/34223291/…

– maheswaran
Apr 4 at 18:49












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388188%2fios-swift-pin-pem-certificate-to-run-rest-post-request%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388188%2fios-swift-pin-pem-certificate-to-run-rest-post-request%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript