0

I want to initialize a new System.Security.Cryptography.ECDsa using the ed25519 curve in .Net 7 without external dependencies. I am loading a dev-only private key from bytes, and want to sign hashes using it.

Something like:

var ecdsa = ECDsa.Create(new ECParameters
{
    Curve = ECCurve.CreateFromParams(ed25519 params...),
    D = privateKeyBytes,
});

My main trouble is with ECCurve: https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.eccurve?view=net-7.0. I'm not sure how to create OIDs, or how OID relates to ECCurves. I looked online and couldn't find any examples. I don't want to import BouncyCastle or other dependencies. I don't care about efficiency.

I know ECCurve in .net 7.0 does support some named curves, but it does not support ed25519.

How can I initialize a new System.Security.Cryptography.ECDsa using the ed25519 curve in .Net 7 without external dependencies?

gannonbarnett
  • 1,638
  • 1
  • 16
  • 28
  • The algorithms for ECDSA and EdDSA are different. Even if you define the curve (e.g. analogous to [here](https://stackoverflow.com/q/65039528/9014097), but for Ed25519, [here](https://neuromancer.sk/std/other/Ed25519)) `SignData()` etc. will presumably not give the expected result. – Topaco May 04 '23 at 08:45

0 Answers0