You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
I have tried to connect with my server in this way:
1. MYServiceSoap11Binding *bind = [[MYService MYServiceSoap11Binding]
retain];
2. MYService_receiveData *request= [[MY_receiveData new] autorelease];
3. MYSoap11BindingResponse *resp= [bind receiveDataUsingParameters:request
];
If I connect to server without certificates is ok, but when I try to connect
with Self-signed server certificate (https), I have followed the 'Advanced
Options' instructions. The connection started with the method
sendHTTPCallUsingBody:(NSString *)outputBody soapAction:(NSString *)soapAction
forOperation:(MYServiceSoap11BindingOperation *)operation
of the class MYServiceSoap11Binding as follows:
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:operation];
operation.urlConnection = connection;
[connection start];
How Operation is delegated of the connection, It have to implement
-(void)connection:(NSURLConnection *)connection
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
that say apple where I send the certificate. But it doesn't implement this
method. I have to implement it using this code.
- (BOOL)authenticateForChallenge:(NSURLAuthenticationChallenge *)challenge
{
if ([challenge previousFailureCount] > 0) {
return NO;
}
NSURLCredential *newCredential = nil;
NSURLProtectionSpace *protectionSpace = [challenge protectionSpace];
SecurityCenter *securityCenter = [SecurityCenter sharedInstance];
// server authentication - NSURLAuthenticationMethodServerTrust
if ([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
SecTrustRef trust = [protectionSpace serverTrust];
NSArray *anchors = [securityCenter serverAnchors];
SecTrustSetAnchorCertificates(trust, (CFArrayRef)anchors);
SecTrustSetAnchorCertificatesOnly(trust, YES);
SecTrustResultType res = kSecTrustResultInvalid;
OSStatus sanityChesk = SecTrustEvaluate(trust, &res);
if ((sanityChesk == noErr)
&& [self validateResult:res]) {
newCredential = [NSURLCredential credentialForTrust:trust];
[[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge];
return YES;
}
return NO;
}
[NSException raise:@"Authentication method not supported" format:@"%@ not supported.", [protectionSpace authenticationMethod]];
return NO;
}
I`m working with last version of source code in iOS7.
Original issue reported on code.google.com by [email protected] on 10 Jan 2014 at 2:56
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 10 Jan 2014 at 2:56The text was updated successfully, but these errors were encountered: