I'm try to generate key pairs with CryptoKit, but seems like the key pairs is not compatible with other platform like https://8gwifi.org/ecsignverify.jsp
import CryptoKit
...
let privateKey = P256.Signing.PrivateKey()
let publicKey = privateKey.publicKey
//using this send this string to other platform
let publicKeyPem = publicKey.pemRepresentation
//keeping this one on my keychain
let privateKeyPem = privateKey.pemRepresentation
but this keypairs can't be verified in other platform, like when I sign some data with private key and can't be verified by someoneelse(but it works well on iOS platform, is there something I missed?)
You are using two different Curves. The link you specified shows that you are trying to initiate a secp256k1 key, but that is not the same as CryptoKit P256 - which is the Curve secp256r1, notice last two chara k1 != r1. Even if private key instantiation succeeds, the public keys will differ, so signature validation (verification) will always fail.
Can you use secp256r1? It is present in the list on the site you linked to, above sect571r1.
Do you have to use secp256k1? If so you can use
https://github.com/Sajjon/K1
Want to use secp256k1 in CryptoKit in the future? Help me upvote my proposal to get it added to swift-crypto (open source variant of CryptoKit)!