I need a FTP TLS Connection for my iPhone-App. A normal FTP-Connection works fine. But I need also a secure TLS connection. I used the code from Apple´s SimpleFTPSample for the iPhone:
ftpStream = CFReadStreamCreateWithFTPURL(NULL, (CFURLRef) url);
self.networkStream = (NSInputStream *) ftpStream;
[self.networkStream retain];
self.networkStream.delegate = self;
CFReadStreamSetProperty((CFReadStreamRef)self.networkStream, kCFStreamPropertyFTPUserName, (CFStringRef)@"ftpuser");
CFReadStreamSetProperty((CFReadStreamRef)self.networkStream, kCFStreamPropertyFTPPassword, (CFStringRef)myFTPPassWord);
[self.networkStream scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
[self.networkStream open];
This works fine for a normal FTP Connection.
But how do I setup a TLS Connection? I´m not sure what I need and if a TLS Connection works?
I tried some code:
NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithCapacity:5];
[settings setObject:(NSString *)NSStreamSocketSecurityLevelTLSv1 forKey:(NSString *)kCFStreamSSLLevel];
[settings setObject:[NSNumber numberWithBool:YES] forKey:(NSString *)kCFStreamSSLAllowsAnyRoot];
CFReadStreamSetProperty((CFReadStreamRef)self.networkStream, kCFStreamPropertySSLSettings, (CFTypeRef)settings);
But without any success. Please can somebody help me. I need a FTP TLS Connection which is protected with a FTP Username and FTP Password.
Thanks!