I've read this question on stackoverflow so I knew I can't read an installed certification in configuration profile from an app.
Here's what I've tried:
- Copy the certificate (.p12) which is self-signed from my macbook through AirDrop.
- Then iPhone will asked me to install it, so I installed.
- Now I can see the certificate in
Settings->General->Profiles & Device Management
, but in the profile there are red wordsNot Verified
belowSigned by
. I guess it is because the certificate is self-signed. - I develop an app that use
[NSURLSession dataTaskWithURL: ...]
to request an web page, without[URLSession: didReceiveChallenge: ...]
. - The app got error
Code=-1202 "The certificate for this server is invalid."
, which is the same error I got before I installed the certificate.
UPDATE: I tried it again and I noticed that the certificate I got is not signed, maybe this is the real reason why I failed and the profile shows not verified? Maybe I should ask my colleague who give me this certificate.
What I need is to copy a self-signed certificate (.p12) from my OSX into my iPhone/iPad and then develop an app to read it as a credential when calling a web API.
Since each authorized user will get different certificates, I can't just put the certificate in the app's main bundle.
I know I can download a certificate through an app (maybe with some authorized token), but since the server hasn't developed this api yet, I need to copy certificate manually when I test my app.
Can someone teach me how to copy the certificate and read it from my develop app.
Thanks for your help :)