I can't find information about EC curve used by Apple's iOS platform. The algorithm name that I could see in their docs is:
eciesEncryptionCofactorVariableIVX963SHA256AESGCM
However, there is no any explanation what it refers to. I've tried to find info about cofactor IVX963 with n/a so far. I read somewhere that Apple has adopted DJB's Curve25519. Is this the one that iOS uses as well?
If not, probably you can provide some pointers like NIST refs or anything else in public domain explaining what this is exactly.
Answer below is good (I've accepted it) and it does provide a lot of information, but clarification is still required.
The only ref that links curve in question with p256r1 is from a private blogger who primarily talks about generating curves of different types. While p256r1 has been generated in the demo, he doesn't know what other curves can be generated this way, nor it's clear how his curve generating scripts are related to the curve in this post.
This rough demo script isn’t set up to handle curves other than P256v1
More information is needed
- A more official link that explains what this curve is
- Equation type, domain parameters, etc.
I hope, it's not P256r1/v1
Please also note that the recommended curve is not even available in iOS 14.1, which is very recent
Type 'SecKeyAlgorithm' has no member 'kSecKeyAlgorithmECIESEncryptionCofactorVariableIVX963SHA256AESGCM
UPDATE I found the new link provided by @kelalaka very useful and practical, especially this part of it:
import Sodium let sodium = Sodium() let curve25519KeyPair = sodium.box.keyPair() let privateKey = curve25519KeyPair!.secretKey let publicKey = curve25519KeyPair!.publicKey
This is what everyone should use in EC domain, not the old and obscure Apple's CommonCrypto