iOS: Creating a server socket for mutual SSL authentication using GCDAsyncSocket -


I'm pulling my hair on it and appreciate some help from this. Unfortunately, my experience with SSL is quite limited, so I do not know where I am wrong.

I have to develop an iOS app that acts as a server with a customer with mutual SSL authentication. I am using the GCDAsyncSocket Library and I have managed to work with the server (without SSL), however, I am working on SSL, I have had a look at this, however, this is what I want Do not describe the steps required to complete.

In the context of Certificate Setup, I have the following P12 certificates: <

  • Self-signed server root CA certificate
  • The above server certificate issued by the server (ServerCert).
  • Self-signed client root CA certificate
  • Client certificate issued by client (ClientCart).
  • Then I installed both the root CA certificates on the iOS device and bundled the server certificate in my app. When a new socket is accepted, I remove the certificate information from the P-12 file (according to the) before starting the SSL file, and sets the SSL settings:

      - (NSDictionary *) LoadSSLSettings {// SSL / TLS Settings Configure NSMutableDictionary * Settings = [NSMutableDictionary DictionaryWithCapacity: 4]; // Configure this connection as server [settings set object: [nsn number number window: yes] for: (NSString *) kCFStreamSSLIsServer]; CFArrayRef certsArray = [auto-load certificate]; [Setting Object: CFBridgingRelease (certsArray) forKey: (NSString *) kCFStreamSSLCertificates]; [Setting Object: NSStreamSocketSecurityLevelNegotiatedSL forKey: (NSString *) kCFStreamSSLLevel]; [SETTING SET OBJECT: (ID) for KCFBoni True: (NSSTING * KCFSTREAM SLAAAERIT Route); Return settings; } - (CFArrayRef) Load Certificate [// Load Certificate NSString * path = [[NSBundle main bundle] pathForResource: @ "ServerCert" type: @ "P12"]; NSDTA * p12data = [NSData data content content: path]; CFDataRef inP12data = (__Briff CFDataRef) p12data; Secuity Rif MyIndenti; Sacredstruff Maestroat; Remove Control and Trust (IP12 DETA, AND MEDENETTY, and MITRST); SecCertificateRef myCertificate; SecIdentityCopyCertificate (myIdentity, and myCertificate); Constant Worth * certs [] = {myCertificate}; CFArrayRef certsArray = CFArrayCreate (NULL, certs, 1, NULL); Return Catar's Array; }  

    This code loads a valid certificate, but then when I am using openSSL, client connections (without attempting mutual SSL), such as:

    Openssl s_client -connect 192.168.2.8:1700 -state -debug

    I get the following output:

      & gt; SSL_connect: Before / connect initialization & gt; SSL_connect: Open the SSLv2 / v3 client A & gt; SSL_connect: Error Hello A  

    in server reading SSLv2 / v3 and it generates iOS logs from the GCDsynchronousSocket Library:

    Error in CFStreamSetProperty, code: 8

    All I can tell is that code 8 is 'other'.

    I am in a disadvantage on the things that are wrong ... maybe I am doing something wrong by default, and if so, then I am very much appreciated by pointing at it :)

    In addition to this, once I withdraw this step, when I send through one, how would I have to go about validating the client certificate?

    If I have left any important information, please tell me and I will happily add it.

    Thank you!


    Comments