Hi, I'm trying to convert my ed25519 keypair to x25519 keypair, which can be achieved by provided functions
- sodium.crypto_sign_ed25519_pk_to_curve25519(x25519_public, ed25519_public)
- sodium.crypto_sign_ed25519_sk_to_curve25519(x25519_secret, ed25519_secret)
Currently I'm generating x25519 keypair buffer with the following functions
{
publicKey: sodium.sodium_malloc(sodium.crypto_box_PUBLICKEYBYTES),
secretKey: sodium.sodium_malloc(sodium.crypto_box_SECRETKEYBYTES)
}
I was able to convert public key, but it looks like converting secret key raises the following assertion error.
edSk must be 'crypto_sign_ed25519_SECRETKEYBYTES' long
My ed25519 secret key is 32 bytes, and it looks like crypto_sign_ed25519_SECRETKEYBYTES is 64 bytes. Now what I'm curious is even though it's checking for 64 bytes, it looks like a subsequent call is only using 32 bytes of the buffer
- Is there a reason the assertion is looking for 64 bytes when only 32 bytes are being used?
- Is it safe if I just pad additional 32 bytes to my private key and pass this assertion?
Hi, I'm trying to convert my ed25519 keypair to x25519 keypair, which can be achieved by provided functions
Currently I'm generating x25519 keypair buffer with the following functions
I was able to convert public key, but it looks like converting secret key raises the following assertion error.
My ed25519 secret key is 32 bytes, and it looks like
crypto_sign_ed25519_SECRETKEYBYTESis 64 bytes. Now what I'm curious is even though it's checking for 64 bytes, it looks like a subsequent call is only using 32 bytes of the buffer