iPhone Simulator custom CA certificate

2019-06-23 08:12发布

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.

3条回答
我欲成王,谁敢阻挡
2楼-- · 2019-06-23 08:27

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.

查看更多
在下西门庆
3楼-- · 2019-06-23 08:32

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

查看更多
Melony?
4楼-- · 2019-06-23 08:41

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.

查看更多
登录 后发表回答