A quick search for SecKeyCreateWithData reveals that it isn't the most straight-forward API to use for many Developers' use-cases ...
It seems reasonable that Developers who wish to use ECDSA for any sort of server <==> iOS communication discrete data exchange should be able to simply:
1. Fire up Terminal
2. Create Private + Public ECDSA keys:
# Generate an ECDSA Private key.
openssl ecparam -genkey -name prime256v1 -out ec256-private.pem
# Generate an ECDSA Public key.
openssl ec -in ec256-private.pem -pubout -out ec256-public.pem
3. <-- Follow some steps to use the Base64 .pem to create keys in iOS -->
4. Use SecKeyCreateWithData, ex:
let publicKey = SecKeyCreateWithData(pemData as CFData ...)
@eskimo -- might you consider creating a step-by-step tutorial as to your / Apple's best recommendation on how to accomplish this?
Your responsiveness on the forums is excellent, so thank you. It just seems that individual Developer issues could be avoided if "best practice" guide existed.
Perhaps a good example for the guide: take some data & an associated, hex-encoded signature (generated server-side) and, using iOS, verify it's legitimate, e.g.:
- Step 1: create a public key from a supplied PEM file using SecKeyCreateWithData
- Step 2: use SecKeyVerifySignature (w/ the publicKey), to verify