ios - SSL in stream socket connection -
i'm working in ios
application. i'm trying connect https
server nsstream
connection. nsurlconnection
, work fine , can trusted challenge :
-(void)connection:(nsurlconnection *)connection didreceiveauthenticationchallenge:(nsurlauthenticationchallenge *)challenge { }
but problem delegate available in stream :
- (void) stream:(nsstream *)stream handleevent:(nsstreamevent)eventcode { }
how manage ?
i found solution. wireshark
[instream setproperty:(id)kcfbooleanfalse forkey:(nsstring *)kcfstreampropertyshouldclosenativesocket]; [outstream setproperty:(id)kcfbooleanfalse forkey:(nsstring *)kcfstreampropertyshouldclosenativesocket]; nsmutabledictionary *settings = [nsmutabledictionary dictionarywithcapacity:1]; [settings setobject:_certificates forkey:(id)kcfstreamsslcertificates]; [settings setobject:(nsstring *)nsstreamsocketsecuritylevelnegotiatedssl forkey:(nsstring *)kcfstreamssllevel]; [settings setobject:[nsnumber numberwithbool:yes] forkey:(nsstring *)kcfstreamsslallowsanyroot]; [settings setobject:@"my host" forkey:(nsstring *)kcfstreamsslpeername]; cfreadstreamsetproperty((cfreadstreamref)instream, kcfstreampropertysslsettings, (cftyperef)settings); cfwritestreamsetproperty((cfwritestreamref)outstream, kcfstreampropertysslsettings, (cftyperef)settings);
the important set certificate without current certificate. should set current identity , other certificate in chain. should set iosx using identity , private key available stream.
hope help
Comments
Post a Comment