我对 iPhone 开发非常陌生。
我从下面的链接下载了 iPhoneHTTPServer 应用程序。 https://github.com/robbiehanson/CocoaHTTPServer/tree/master/Samples/iPhoneHTTPServer
它适用于 HTTP 请求。
现在我想把它变成一个安全的服务器。(使用 HTTPS)为此我在 MyHTTPConnection.m 中覆盖了以下两种方法
我确信这种方法的变化:
/**
* Overrides HTTPConnection's method
**/
- (BOOL)isSecureServer
{
// Create an HTTPS server (all connections will be secured via SSL/TLS)
return YES;
}
我需要应用以下方法的更改:(请在此处指导我。)问题:DDKeychain 和 Cocoa.h 不适用于 iOS。
/**
* Overrides HTTPConnection's method
*
* This method is expected to returns an array appropriate for use in
* kCFStreamSSLCertificates SSL Settings.
* It should be an array of SecCertificateRefs except for the first element in
* the array, which is a SecIdentityRef.
**/
- (NSArray *)sslIdentityAndCertificates
{
NSArray *result = [DDKeychain SSLIdentityAndCertificates];
if([result count] == 0)
{
[DDKeychain createNewIdentity];
return [DDKeychain SSLIdentityAndCertificates];
}
return result;
}