iPhone Simulator custom CA certificate

此生再无相见时 提交于 2020-01-03 14:23:05

问题


I'd like to test an application on the iphone simulator which connects to a service using a certificate which is signed by our own CA. I can do this on the actual device by adding a provisioning profile which has the CA certificate. I had thought that having the CA certificate in the standard OSX keychain would work, but it doesn't.

So I can access the service via Safari without warning, but I get error when trying to run things in simulator.


回答1:


The crypto api's are unavailable to the simulator. I think someone at apple was smoking crack when they made this decision because i fail to see how having an iPhone changes the out come of a cryptographic algorithm. Never the less in order to develop with these systems you'll need an iphone or ipod touch.




回答2:


This link worked for me

canAuthenticateAgainstProtectionSpace method set to return yes. NOTE: this will accept any certificate so should be removed for production releases: ie: ONLY for testing




回答3:


It seems to work okay when I point the emulator at one of our live servers which a use a 'real' certificate. But I've just been getting 1200 errors trying to get the emulator to talk to a local test server I set up this morning.

So there must be crypto libraries there (or our app wouldn't talk to the live servers with real certificates), but there certainly seems to be a problem with self-signed certs.



来源:https://stackoverflow.com/questions/2329163/iphone-simulator-custom-ca-certificate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!