iphone - Accept untrusted SSL server certificate with CFStream socket on iOS -


i need open cfstream socket connection server has untrusted ca root. have certificate of server, , can create seccertificateref structure it. problem how set properties of stream.

i think should set kcfstreampropertysslsettings property cfdictionary in turn contains kcfstreamsslcertificates key. key should hold "a cfarray of seccertificaterefs except first element in array, secidentityref" according docs. can create seccertificateref server's certificate i'll ship app, how secidentityref? guess should client identity absolutely don't want client side authentication now. , can't find way how feed cfstream server certificate.

note, don't want add untrusted certificate keychain, neither disable kcfstreamsslvalidatescertificatechain in settings. need accept server authentication if based on own server certificate data loaded disk, , on cfstream.

i not have direct answer question, perhaps few guidelines:

  1. why need use cfstream api , not more intuitive nsurlconnection ?
    find in documentation, seams not available mac os x, regarding cfstream api, available ios. think it, , see if can switch nsurlconnection :-)

  2. for nsurlconnection, can use nsurlconnectiondelegate methods ssl challenge , validate certificate on own. can check wsdl2objc project, have implemented these features:

  3. now questions :-)
    don't see how can set custom (untrusted) ca in kcfstreampropertysslsettings. i'm not sure if can done using kcfstreamsslcertificates since meant used setting client-side certificates (thus requirement of having secidentityref on index 0, provides private key).

  4. when don't want add certificate keychain, mean manually or programmatically ? guess don't users of app have manually, can use security api import certificate programatically. in case certificate imported in sandboxed keychain available application. (again, not sure if work worths try)

in applications use nsurlconnectiondelegate manually validate untrusted certificates.

regards,
pece


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -