Closed AndreasGassmann closed 2 years ago
StableLib doesn't have the equivalent of crypto_kx_server|client_session_keys
, so you'll need to implement them yourself: https://github.com/jedisct1/libsodium/blob/6d566070b48efd2fa099bbe9822914455150aba9/src/libsodium/crypto_kx/crypto_kx.c#L75-L113
(libsodium's generic hash is BLAKE2b)
Hello @dchest,
This issue is marked as completed. Have equivalents of crypto_kx_server|client_session_keys
actually been implemented? I don't see anything in this repo.
Thank you for a great library.
Sorry, there was no plan to implement them. I've marked it now differently.
This feature is now available in @stablelib/x25519-session
package. Thank you, @e-asphyx.
Docs: https://www.stablelib.com/modules/_stablelib_x25519_session.html
We're currently using
libsodium
in our library and we would like to switch to@stablelib
. I found replacements for most methods that we use, but I'm having a hard time to compute the shared key to do encryption and decryption withbox
.With libsodium, I have something like this now:
The
server
andclient
variables then each have asharedRx
andsharedTx
property, I usesharedRx
to decrypt andsharedTx
to encrypt.If I use those keys with the
@stablelib
methods (eg.const openBox = openSecretBox(sharedRx, nonce, ciphertext)
), then it decrypts correctly.So my question is how I can calculate those
sharedRx
andsharedTx
values with@stablelib
?I tried to do the following:
But that key looks different than all other keys and it doesn't seem to decrypt the payload correctly.
To be more precise, if I update both sides with the
precomputeSharedKey
from@stablelib
, then encryption and decryption works. But the encryption and decryption does not work if one side uses the shared key from@stablelib
and the other side uses the shared key fromlibsodium
.How can I calculate a shared key with
@stablelib
that is equivalent to the onelibsodium
calculates?Thanks a lot for your help.