NetSparkleUpdater / NetSparkle

NetSparkle is a C#, cross-platform, highly-configurable software update framework with pre-built UI for .NET developers compatible with .NET 4.6.2/.NET 6+, WinForms, WPF, and Avalonia; uses Ed25519 signatures. View basic usage here in the README and try the samples for yourself.
https://netsparkleupdater.github.io/NetSparkle/
MIT License
606 stars 84 forks source link

Bouncy Castle dependency - replaceable with in-box cryptography? #461

Closed christophwille closed 2 months ago

christophwille commented 1 year ago

The four assemblies for netsparkle come in at 3.46MB, with Bouncy Castle accounting for 3.16 (2.2.2 WPF .Core distribution). That is quite a hefty "penalty" - what is Bouncy Castle used for (ie would it be possible to at least replace it on .NET (Core) with in-box cryptography?)

christophwille commented 1 year ago

Unless I am mistaken, there is only one place in the main package, namely https://github.com/NetSparkleUpdater/NetSparkle/blob/develop/src/NetSparkle/SignatureVerifiers/Ed25519Checker.cs (AppCast generation isn't something I am concerned about as this is a dev dependency).

Deadpikle commented 1 year ago

You're not mistaken. That's the one place where it is used.

If you can point me to a library that is similarly trustworthy and unit tested, or a built-in way to do this in .NET that works from 4.5.2 (or 4.6.2) all the way through .NET 7+, I'd be interested in taking a look.

Alternatively, would trimming the DLL in your own application (and making sure NetSparkle was trimmable) be the solution, here? It seems as though that would allow us to continue to use BouncyCastle (with its benefits and google-ability) while not bogging down published apps.

Edit: Links for future ref: https://github.com/bcgit/bc-csharp/issues/451, https://github.com/bcgit/bc-csharp/issues/422, https://github.com/bcgit/bc-csharp/issues/504

Deadpikle commented 1 year ago

Some additional applicable old discussion here: https://github.com/NetSparkleUpdater/NetSparkle/pull/98

christophwille commented 1 year ago

Isn't NSec doing just that?

Deadpikle commented 2 months ago

BouncyCastle now supports trimming, and when your application is trimmed, the file size of BouncyCastle is reduced quite a bit (in my tests, to less than 50 KB). So, if your application supports trimming, this shouldn't be a problem.

If your application does not support trimming out of the box:

The other option I'd be willing to consider is using Chaos.NaCl (my fork here with .NET Standard compat), but that'd take some work to move in since we'd need to add in file streaming compatibility at the very least.

In any case, with the changes on BouncyCastle's side and trimming available on the NetSparkle side along with the option of just shipping a self-trimmed DLL to your users, I think this can be resolved for end users.

Deadpikle commented 1 month ago

I have again made an adjustment after seeing that the above wasn't going to result in the best experience for end users by switching fully to Chaos.NaCl, of which we have a fork here. This should fully alleviate the concerns that you shared as it is a small DLL, even without trimming, at less than 250 KB. BouncyCastle is no longer used. As a bonus, the core lib is now trimmable and AoT-compatible, so some good things came out of it.

Thanks!