Organizational Research By

Surprising Reserch Topic

Question:SSL/TLS server running on an iOS device


It is possible to build an SSL/TLS server which is running on an iOS device? If yes, how?

My doubts are related to these questions: On the device, can I create on the fly a self-signed certificate to be used from then on? Or can I tell SSL/TLS not to use certificates?

In my iOS app I'm using AsyncSocket. The app is at the same time both client and server.

The client-side is implemented in this way:

- (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port {
    // Don't even validate the certificate chain
    NSDictionary *settings = @{(NSString *)kCFStreamSSLValidatesCertificateChain : (id)kCFBooleanFalse};

    [sock startTLS:settings];
}

- (void)onSocketDidSecure:(AsyncSocket *)sock {
    // omitted: send the message...
}

The server-side (which is running on another iOS device) is implemented in this way:

- (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port {
    // Don't even validate the certificate chain
    NSDictionary *settings = @{(NSString *)kCFStreamSSLValidatesCertificateChain : (id)kCFBooleanFalse,
                            (NSString *)kCFStreamSSLIsServer : (id)kCFBooleanTrue};

    [sock startTLS:settings];
}

- (void)onSocketDidSecure:(AsyncSocket *)sock {
    // omitted: read the message...
}

However, when the client attempts to connect to the server, the delegate's method onSocket:willDisconnectWithError: is called, with the error Domain=kCFStreamErrorDomainSSL Code=-9848.

 

asked Sep 13, 2013 in IIS by rajesh
edited Sep 12, 2013
0 votes
349 views



Related Hot Questions



Government Jobs Opening


...