Open danielcrenna opened 4 years ago
danielcrenna's commit https://github.com/Metalnem/noise/commit/6c5fdb68d13e4a36b2f3c9070556359e649a7a54
The nsec.net lib uses libsodium too and has the reverse problem. See https://github.com/ektrah/nsec/issues/31
Fwiw, I think it's totally the right way to do (passing keys around as KeyPair
instances rather than byte arrays & storing private keys in sodium_malloc'd memory). The "problem" I'm facing with NSec is that API users are consistently undermining this by recreating the KeyPair
instances from byte arrays on every single library invocation. I guess this might be less of a problem in a Noise implementation, which will probably more likely expose a "HandshakeState"- or "Connection"-oriented API rather than an "Algorithm"- and "KeyPair"-API.
In order to facilitate secure memory solutions,
KeyPair
:KeyPair
storage (i.e. in factory methods alaCurve25519.GenerateKeyPair
buffer.Clear()
to zero out memory on disposal, rather deferring to something likelibsodium_free
This is a pre-requisite for enabling secure memory scenarios in this library, and could work for PSKs in the
Protocol
API methods.