How to convert X25519 to Ed25519 key properly so it's combatible with curve-js js lib? #1387
Replies: 2 comments 1 reply
-
@jedisct1 sorry for mentioning you directly, but maybe you could help with creating the caption 🙏 |
Beta Was this translation helpful? Give feedback.
-
Ed25519 secret keys are made of the seed, and the public key. The seed is hashed in order to compute the secret scalar. So, the only option is to reimplement Ed25519, with the low-level That requires a bit of work. Things would be way easier, without non-standard hacks if done the other way round (Ed25519 keys used both for signatures and key exchange). Also see How can I sign and encrypt using the same key pair? in the FAQ. |
Beta Was this translation helpful? Give feedback.
-
Hi!
We're trying to migrate from one 26 stars curve-js library (https://github.com/harveyconnor/curve25519-js) to libsodium in JS (Node) using libsodium-wrappers package.
The main purpose - libsodium is sooo fast if we compare it with pure-js implementaiton and other libraries, thank you for that! 🫶
The library seems to implement the standard X25519 and Ed25519 algorithm, just as libsodium
But the curve-js main focus on x25519 keys and from it the lib converts Curve25519 secret key into Ed25519 secret key and converts Curve25519 public key back to Ed25519 public key in an interesting way (not sure if it's standard of doing that)
So there's 4 operations we need, basically:
sodium.crypto_box_seed_keypair
)sodium.crypto_scalarmult
)sodium.crypto_sign_verify_detached
.sodium.crypto_sign_detached
and tried to covert x25519 to Ed25519 just as curvejs do during signature process, but no luck so far :(So my questions about those:
I'm not super familiar with the details of curve25519 and Ed25519, but may be someone who is familiar could check that and give me the right direction where tooo look?
I can provide the minimum reproducible tests and code, if anyone need.
Beta Was this translation helpful? Give feedback.
All reactions