whyoleg/cryptography-kotlin

Support for EC.Curve("secp256r1")

Closed this issue · 3 comments

Is secp256r1 (not secp256k1) supported?
I cannot find it in the definitions of available curves, but was wondering of using it like this
EC.Curve("secp256r1")
possible or do you have to add support for this type of elliptic curve?

Thanks and nice looking library regardless for KMM.

Hey! secp256r1 is the alternative name for P256, so you can just use EC.Curve.P256.

Still, EC.Curve("secp256r1") will probably also work on some of the providers, as they have underlying alternative name resolution (like in the OpenSSL case).
It probably makes sense to have a comment about it in KDoc. We can also introduce an additional property, secp256r1, there, but I'm a bit afraid that because its name differs by one letter from the other popular curve, secp256k1, it might not be the best idea.

Thanks a lot.

A different question. Is it possible to compute a public key from a private key for a certain curve at the moment?

Nope, it's not possible currently due to underlying providers API limitations.
Feel free to create a separate issue for this.