Member-only story
No Legacy Crypto: Meet NSec.Cryptography
If you use OpenSSL, you are likely to find it blotted and full of legacy methods. Every single legacy method adds vulnerabilities to the code, even though few people are likely to use these methods. So how do we create lightweight cryptography code, and which does not bring in the baggage of the past? Well, one library is Nsec.cryptography and which runs on .NET. It uses Libsodium code platform and which has secure methods for handling keys (and which can be securely erased). Overall it contains the best in practice methods [here]:
The key derivation functions include HKDF and, for passwords, we have Argon2id and scrypt. For symmetric key, we have with either 256-bit AES GCM and ChaCha20. With hashing, we only see SHA-256, SHA-512 and Blake2b. We see here that we do not have secp256k1 and NIST P256 curves for key exchange and digital signatures, but use Curve 25519 to implement X25519 and Ed25519. So let’s implement Ed25519 and X25519 with NSec.cryptography.
Ed25519 with NSec.Cryptography
Ed25519 — Edwards-curve Digital Signature Algorithm (EdDSA) — uses Curve 25519 and SHA-512 to produce an EdDSA signature. In this case, we will perform…
