我正在使用不同的 p12 证书对我的服务器进行两次调用。问题是,在第二次调用中,它使用的是第一次调用中的证书,即使我为它分配了一个新证书。
第一次调用(它下载我想用于第二次调用的第二个证书):
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request addRequestHeader:@"Content-Type" value:@"application/x-pkcs12"];
[request setValidatesSecureCertificate:YES];
[request setCachePolicy: ASIDoNotWriteToCacheCachePolicy | ASIDoNotReadFromCacheCachePolicy];
[request setClientCertificateIdentity:[self copyClientCertificate]];
[request setDownloadDestinationPath:thePath];
[request setDelegate:self];
[request setUseCookiePersistence:YES];
[request startAsynchronous];
[request setDidReceiveResponseHeadersSelector:@selector(didReceiveResponseHeaders:)];
[request setDidFinishSelector:@selector(ConnectFinished:)];
在第二次通话中:
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setValidatesSecureCertificate:YES];
[request setCachePolicy: ASIDoNotWriteToCacheCachePolicy | ASIDoNotReadFromCacheCachePolicy];
[request setClientCertificateIdentity:[self copyClientCertificate2]];
[request setCachePolicy:ASIDoNotReadFromCacheCachePolicy];
[request setDelegate:self];
[request setUseCookiePersistence:YES];
[request startAsynchronous];
[request setDidFinishSelector:@selector(ConnectFinished2:)];
但是,我可以在我的服务器中看到第二个调用正在使用第一个证书,即使它在copyClientCertificate2上获得了另一个证书。那么证书是否被缓存?如何明确告诉第二个 ASIHTTPRequest 使用第二个证书?
注意:它是 2 个不同的 URL,但域相同。
谢谢!