1
$\begingroup$

I'm new to crypto and I want to generate a key pair, in C, which would be the equivalent of openssl ecparam -name secp256k1 -genkey -out ec-priv.pem.

I love libsodium API but I can't find how (if ever) to generate a key pair that is an EC key. I was expecting to get a 32-byte private key, and a 64 byte (+0x04) public key.

Is it something that is not offered by the high-level libsodium API?

$\endgroup$
0
4
$\begingroup$

Your question has been asked on the GitHub, too:

Is there some way with sodium/libsodium to make all crypto_sign_* methods use SECp256k1?

And the answer was given as

No, there isn't, and there never will be.

Libsodium is an opinionated API. You get one good algorithm for every use case. Fewer knobs and levers + more secure constructions = less crypto vulns in software that consumes the API.

For public key cryptography, you get ECDH and EdDSA over Curve25519. No Weierstrass or Koblitz curves.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.