在我的 iPhone 应用程序中,我想连接我的 SSL 服务器套接字(Java 中)。我有自己的证书。我正在尝试将其添加到我的应用程序中,但我不知道该怎么做。
没有 SSL,通信工作:
@interface ViewController ()
@end
@implementation ViewController
@synthesize openResponse;
@synthesize general; 
@synthesize response = _response;
- (void)viewDidLoad
{
 [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{ 
[self setOpenResponse:nil];
[self setGeneral:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (IBAction)open:(id)sender {
    [self initNetworkCommunication];
Byte sendBuffer[4];
sendBuffer[0]=0x6b;
sendBuffer[1]=0x6f;
sendBuffer[2]=0x6c;
sendBuffer[3]=0x61;
[outputStream write:sendBuffer maxLength:4];
 }
- (void)initNetworkCommunication{
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"mypage.com", 4444, &readStream, &writeStream);
inputStream = (__bridge NSInputStream *)readStream;
outputStream = (__bridge NSOutputStream *) writeStream;
[inputStream setDelegate:self];
[outputStream setDelegate:self];
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[inputStream open];
[outputStream open];
}
- (void)stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent
{
 switch (streamEvent) {
    case NSStreamEventOpenCompleted: {
        NSLog(@"Stream opened");
        break;
    }
    case NSStreamEventHasBytesAvailable: {
        NSLog(@"Data!");
        if (theStream == inputStream) {
            uint8_t buffer[1024];
            int len;
            while ([inputStream hasBytesAvailable]) {
                len = [inputStream read:buffer maxLength:sizeof(buffer)];
                if (len > 0) {
                    NSString *output = [[NSString alloc] initWithBytes:buffer length:len encoding:NSASCIIStringEncoding];
                    if (nil != output) {
                        NSLog(@"server said: %@", output);
                        self.response = output;
                        NSString *responseData =[[NSString alloc] initWithFormat:@"El servidor dice: %@",self.response];
                        self.openResponse.text = responseData;
                    }
                }
            }
        }
        break;
        break;
    }
    case NSStreamEventErrorOccurred: {
        NSLog(@"Can not connect to the host!");
        break;
    }
    case NSStreamEventEndEncountered: {
        NSLog(@"End encountered");
        break;
    }
    default:
        NSLog(@"Unknown event");
        break;
}
}
@end
如何将我的证书添加到此代码中?