IPAD must-haves. And fun-to-haves.

Brighten your iPad with a colorful cover, stream to your TV, download pictures from your digital camera, and more. There’s already so much you can do with iPad and iPad mini

Apple Wireless Keyboard

The incredibly thin Apple Wireless Keyboard uses Bluetooth technology, which makes it compatible with iPad

Apple unveils iPad mini: ‘Thin as a pencil, light as paper’

iPad inspires creativity and hands-on learning with features you won’t find in any other educational tool

Lightning connector and FaceTime HD camera

Apple announces 4th generation iPad packing an A6X CPU

Pages

Showing posts with label signed. Show all posts
Showing posts with label signed. Show all posts

Thursday, January 31, 2013

sendSynchronousRequest with self signed certificate

Hi

 

Due to the application design I cannot use the – initWithRequest:delegate: method of NSURLConnection class for my https requests to a server. Hence I have to make synchronous calls using sendSynchronousRequest:returningResponse:error.

 

When I was using initWithRequest , it was taking a class delegate of NSURLConnectionDelegate class hence I handled the self signed certificate problem by the following code:-

 

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {

 

    return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];

}

 

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {

   

    [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];

   

    [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];

}

 

 

Now the problem is that sendSynchronousRequest does not take any delegates to be called on. So now how do I handle non trusted certificate problem using synchronous request.

 

 

I searched but so far can't find any solution.


View the original article here

sendSynchronousRequest with self signed certificate

Hi

 

Due to the application design I cannot use the – initWithRequest:delegate: method of NSURLConnection class for my https requests to a server. Hence I have to make synchronous calls using sendSynchronousRequest:returningResponse:error.

 

When I was using initWithRequest , it was taking a class delegate of NSURLConnectionDelegate class hence I handled the self signed certificate problem by the following code:-

 

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {

 

    return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];

}

 

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {

   

    [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];

   

    [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];

}

 

 

Now the problem is that sendSynchronousRequest does not take any delegates to be called on. So now how do I handle non trusted certificate problem using synchronous request.

 

 

I searched but so far can't find any solution.


View the original article here