Answer the question
In order to leave comments, you need to log in
Problem when authorizing with a client certificate on iOS?
Good day, friends. Faced a strange problem. The iOS app requires you to sign the request with the certificate you received earlier. I am using MKNetworkKit.
- (void)startConnection {
NSString *serverURL = @"host.ru/method";
MKNetworkEngine *engine = [[MKNetworkEngine alloc] initWithHostName:serverURL customHeaderFields:nil];
MKNetworkOperation *op = [engine operationWithPath:nil params:nil httpMethod:@"GET" ssl:YES];
NSString *thePath = [[NSBundle mainBundle] pathForResource:@"client" ofType:@"p12"];
[op setShouldContinueWithInvalidCertificate:YES];
op.clientCertificate = thePath;
op.clientCertificatePassword = @"1234qwerty";
[op addCompletionHandler:^(MKNetworkOperation *operation) {
NSLog(@"[operation responseData]-->>%@", [operation responseString]);
}errorHandler:^(MKNetworkOperation *errorOp, NSError* err) {
NSLog(@"MKNetwork request error : %@", [err localizedDescription]);
}];
[engine enqueueOperation:op];
}
Moscow Standard Time
Request
-------
curl -X GET 'https://host.ru/method', [The operation couldn’t be completed. (NSURLErrorDomain error -1012.)]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question