When my app connects with an account on the server for the first time, the server generates and returns a PKCS12 file with a private key and self-signed certificate from the server.
The purpose of this primary key is to a) decrypt data sent to it by the server, and b) sign requests so the server can verify the identity of the client.
Is there a point in SecTrustEvaluate
in this case? I'm not using the certificate to verify the identity of the server in any way, only for the decryption/signing of data. Currently I have:
SecTrustResultType trustResult;
status = SecTrustEvaluate(myTrust, &trustResult);
NSAssert(status == errSecSuccess, @"SecTrustEvaluate failed.");
This is failing with kSecTrustResultRecoverableTrustFailure - almost certainly due to the self-signed certificate.
If it is required (or highly suggested), can someone point me towards what I would need to do to resolve this?