Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9210247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:01:34+00:00 2026-06-18T01:01:34+00:00

Now I use -connection:didReceiveAuthenticationChallenge: function to check the SSL certificate. Based on the user’s

  • 0

Now I use -connection:didReceiveAuthenticationChallenge: function to check the SSL certificate. Based on the user’s requirement, I need to check all the requests. But in my test demo, the -connection:didReceiveAuthenticationChallenge: delegate function will be called only once in 5 mins. After 5 mins, it will be called again. But our user may send more than one request in 5 mins. Is any one know have to solve this problem?

The request code

NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:_server_url]];
[urlRequest setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setHTTPBody:[query dataUsingEncoding:NSUTF8StringEncoding]];

urlConnection = [[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self] autorelease] ;
[urlConnection scheduleInRunLoop:[NSRunLoop mainRunLoop]
                      forMode:NSDefaultRunLoopMode];
[urlConnection start];

Delegate functions:

- (BOOL)connection:(NSURLConnection *)conn canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
    NSLog(@"authenticate method:%@",protectionSpace.authenticationMethod);

    return YES;
}

- (void) connection:(NSURLConnection *)conn didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge 
{
    NSURLAuthenticationChallenge *_challenge=[challenge retain];

    SecTrustRef trustRef = [[_challenge protectionSpace] serverTrust];
    SecTrustEvaluate(trustRef, NULL);

    SecCertificateRef certRef = SecTrustGetCertificateAtIndex(trustRef, 0);

    NSData *certificateData = (NSData *) SecCertificateCopyData(certRef);
    const unsigned char *certificateDataBytes = (const unsigned char *)[certificateData bytes];
    X509 *certificateX509 = d2i_X509(NULL, &certificateDataBytes, [certificateData length]);

    NSString *subject = CertificateGetDomainName(certificateX509);

    NSLog(@"Subject: %@", subject);

    [[_challenge sender] continueWithoutCredentialForAuthenticationChallenge:_challenge];

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:01:36+00:00Added an answer on June 18, 2026 at 1:01 am

    There is no simple way to flush the TLS cache: http://developer.apple.com/library/ios/#qa/qa1727/_index.html

    Try to rethink your use case to determine whether you really need the authentication every time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am supposed to use JBoss connection pooling for my application.Right now I don't
So i'm really annoyed now.(Still a noob) I'm trying the use my connection string
I want to use Server Managed connection pool in my web application,Now i'm using
Now I use elixir with my mysql database and the redispy with redis and
now i use this code: $welcome_text = mysql_query(SELECT * FROM `text` WHERE `name` =
Right now i use iText to generate a pdf automatically. And my problem is
After a few harsh lessons I now always use OrdinalIgnoreCase when comparing Strings in
i have about 60 fragments ListFragment , now i use each Listfragment with another
I make a simple clock in xcode. For now i use a font to
The live() method was deprecated in jQuery 1.7. The jQuery docs now recommend Use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.