Member-only story
Deterministic and Non-deterministic Key Exchange
If you are into cybersecurity, do you know the difference between deterministic and non-deterministic key generation? Well, with deterministic, we always get the same keys generated when we run our code, and with non-deterministic, we will get a different set of keys created each time, and thus cannot guess what the keys will be. This type of thing happens with signatures, and where we can either know what signature we will get for a given set of keys (deterministic signatures) or not (non-deterministic). If you are interested, ECDSA is a non-deterministic signature method (as it uses a random nonce value), while EdDSA and pure RSA signatures are typically deterministic.
Basically, the deterministic nature of key exchange methods all comes down to the way we generate the keys. If we use a known seed value for these, we will always end up with the same keys. Otherwise, if the keys are generated randomly, we will have a non-deterministic result.
In this case, we will use libsodium.js to implement the ECDH key exchange method, and which implements a WASM integration.
ECDH
With the ECDH (Elliptic Curve Diffie-Hellman) method, Alice generates a secret of a and computes a public key point of a.G, and where G is a base point on the elliptic curve. Bob generates a secret of b and computes a…