Tag: https

NSExceptionAllowsInsecureHTTPLoads不能用于IP地址

排除iOS 9上的ATS不适用于我。 我有一个testing服务器没有域名(只有IP地址),没有SSL证书(所以它是HTTP而不是HTTPS) 尝试: <key>52.24.145.252</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSIncludesSubdomains</key> <true/> </dict> 但是我仍然得到错误: App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. 我究竟做错了什么?

使用MonoTouch,HttpClient和Charles Proxy时出现HTTPstream量监控问题

我是HttpClient类的新手,并且遇到了使用Charles Proxy监视请求的问题。 基本上我需要的是监视从模拟器或实际的iOS设备进行的请求。 在这里你可以find一个关于如何configurationCharles for iOS开发的很好的教程。 我正在做简单的HttpClient请求,只是一个简单的授权 async Task<string> authorizeUser() { HttpClient _client = new HttpClient (); _client.BaseAddress = new Uri("https://…../api/"); _client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue ("bearer", token); var content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("grant_type", "password"), new KeyValuePair<string, string>("username", "theUserName"), new KeyValuePair<string, string>("password", "thePassword") }); var result = await _client.PostAsync("auth", content); string resultContent = […]

SSL身份证书在iOS上运行HTTPS服务器

我正在尝试在iOS应用程序中构buildHTTPS服务器,以充当我的Web应用程序和我的外部服务器之间的代理。 我设法通过侦听套接字来创build一个HTTP服务器,感谢CFSocketRef或使用GCDAsyncSocket库。 我也成功地使用GCDAsyncSocket库来创build一个运行HTTPS服务器的Mac应用程序,并感谢我的方法“secureSocket:”,它保证了连接的安全: – (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket { // (…) // secure the connection [self secureSocket:newSocket]; // (…) } – (void)secureSocket:(GCDAsyncSocket *)sock { // The root self-signed certificate I have created NSString *certificatePath = [[NSBundle mainBundle] pathForResource:@"certificate" ofType:@"cer"]; NSData *certData = [[NSData alloc] initWithContentsOfFile:certificatePath]; CFDataRef certDataRef = (CFDataRef)certData; SecCertificateRef cert = SecCertificateCreateWithData(NULL, certDataRef); [certData […]

Alamofire与自签证书/ ServerTrustPolicy

我想使用Alamofire通过https连接与我的服务器进行自我签名证书通信。 我的环境在本地主机上运行。 我试图连接,但是反应一直如下所示: Success: false Response String: nil 我用下面的代码完成了它: import Foundation import UIKit import Alamofire class MessageView: UITableViewController { let defaultManager: Alamofire.Manager = { let serverTrustPolicies: [String: ServerTrustPolicy] = [ "localhost": .DisableEvaluation ] let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() configuration.HTTPAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders return Alamofire.Manager( configuration: configuration, serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies) ) }() override func viewDidLoad() { super.viewDidLoad() defaultManager […]

HttpListener在MonoTouch上使用HTTPS

我使用MonoTouch中的HttpListener实现了一个非常简单的Web服务器。 一切工作正常。 现在我需要添加HTTPS支持。 我试图按照步骤 Httplistener与https支持 但我不知道在MonoTouch中设置证书的位置。 只要添加前缀“https:// *:443”就没有帮助,因为不可能有连接,也不会引发exception。 根据http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx ,这可能是因为必须指定一个服务器证书(“您可以configuration服务器证书和其他侦听器选项通过使用HttpCfg.exe“)。 我如何在MonoTouch中做到这一点?

如何使用AFNetworking比较SSL证书

在我的iPhone应用程序中,我使用带有自签名SSL证书的https连接从服务器下载合理的数据(用户名和密码)。 这个应用程序仅供私人使用,并不意味着生产。 我正在使用AFNetworkingpipe理https连接,但是,由于我的证书没有从CA签名,为了使其工作,我不得不添加以下内容到AFURLConnectionOperation类的头部: #define _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ 1 但有了这个我的应用程序将允许任何证书。 有没有办法只允许从我的服务器的证书,可能捆绑在应用程序,并与服务器提供的证书在HTTPS连接提供的证书进行比较? 如果可能的话,在安全方面会有什么显着的优势吗? 我对安全非常陌生,我有些困惑。

NSURLConnection / CFURLConnection HTTP加载失败(kCFStreamErrorDomainSSL,-9813)iOS

目前我正在使用块在iOS中消耗肥皂Web服务我的源代码如下 NSString *xml = requestXMLToSent; NSString *msgLength = [NSString stringWithFormat:@"%lu", (unsigned long)[xml length]]; NSURL *serviceURL = [NSURL URLWithString: url]; NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:serviceURL]; [urlRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [urlRequest addValue: serviceURL forHTTPHeaderField:@"SOAPAction"]; [urlRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"]; [urlRequest setHTTPBody: [xml dataUsingEncoding:NSUTF8StringEncoding]]; [urlRequest setHTTPMethod:@"POST"]; [NSURLConnection sendAsynchronousRequest:urlRequest queue:[[NSOperationQueue alloc]init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { if (connectionError == […]

使用自签名证书https卡

我有一个自签名证书的服务器。 我想用httpsforms将我的设备连接到服务器。 我听说我必须接受这个关系。 但我不知道如何。 我有一个自签名证书,因为它是一个testing服务器。 但我想用httpsforms访问它? 当我尝试访问https我有一个错误: SURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813) 然后它是一个自签名证书。 有人可以帮助我吗?