Have you considered using HTTPS with client-certificate authentication? This would definitely solve your authentication problem, but I'm not sure how this works within the iPhone. (Safari has issues with the way client certificates are chosen, for example.)
This would do the authentication at the transport level (TLS, under HTTP).
If you want to do this at the message level (within HTTP), you could also use a digest that you sign with the private key in the header.
There already is a standard header for digests (Content-MD5
) for digests, but I wouldn't recommend MD5 because of weaknesses discovered recently. Try SHA-1 or above perhaps.
Those digests wouldn't be signed, so you would need an extra header to sign this (e.g. X-Content-RsaWithSha1
), and perhaps another one to send the certificate if the server doesn't know which certificate to expect in advance.
You would also need to support reading and verifying those custom headers on the server side.
The HTTPSec specification addresses message-level security at the HTTP level, although I'm not aware of any iPhone implementation.
Regarding the security of the p12 file, if your app intends to use it, you're going to have somehow to ship its password if it's bundled within the app, so cracking the binary would also certainly reveal that password and thus the private key.