News for hackers. Stuff that matters.
Re:Hell Is Overconfident Developers Writing Encryption Code by tptacek on Saturday February 01, 2025 @07:11PM (#42904011)
There's a subtext here of "what do I do when the high-level libraries like Sodium don't do exactly what I need", and the frank answer to that is: "well, you're in trouble, because consulting expertise for this work is extraordinarily expensive".

We have an SCW episode coming out† next week about cryptographic remote filesystems (think: Dropbox, but E2E) with a research team that reviewed 6 different projects, several of them with substantial resources. The vulnerabilities were pretty surprising, and in some cases pretty dire. Complaining that it's hard to solve these problems is a little like being irritated that brain surgery is expensive. I mean, it's good to want things.

† https://securitycryptographywhatever.com/

Re:Hell Is Overconfident Developers Writing Encryption Code by umvi on Saturday February 01, 2025 @09:14PM (#42904978)
> There's a subtext here of "what do I do when the high-level libraries like Sodium don't do exactly what I need", and the frank answer to that is: "well, you're in trouble, because consulting expertise for this work is extraordinarily expensive".

...which is exactly why people roll their own crypto. Security folks don't seem to realize/care that money is a real constraint at most companies (esp. startups) and security can easily become a money furnace. When the only two options are: "use sodium" and "extraordinarily expensive consultant" then devs turn to the third option: https://pkg.go.dev/crypto/aes

Boom, file encrypted, requirement fulfilled, money saved, sale made. Perfectly secure? Probably not. The docs even say "The AES operations in this package are not implemented using constant-time algorithms". But maybe that's an acceptable tradeoff for your target risk profile.

Re:Hell Is Overconfident Developers Writing Encryption Code by Dylan16807 on Saturday February 01, 2025 @11:27PM (#42905811)
I bet more than 90% of the devs turning to a third option could in fact use sodium or an equivalent. Especially if the goal is "boom, file encrypted".
Re:Hell Is Overconfident Developers Writing Encryption Code by umvi on Sunday February 02, 2025 @03:52AM (#42907264)
> or an equivalent

How does one identify the proper "equivalent" in a given programming language that doesn't have 1st class sodium support?

Re:Hell Is Overconfident Developers Writing Encryption Code by Dylan16807 on Sunday February 02, 2025 @12:42PM (#42910218)
Second class sodium is still a hell of a lot better than setting up your own. For go in particular, writing your own wrapper is a reasonable option. It's a handful of lines of code per function used.

I don't have a full guide for identifying a proper equivalent, but "constant time" is a requirement.

Re:Hell Is Overconfident Developers Writing Encryption Code by akerl_ on Saturday February 01, 2025 @10:41PM (#42905587)
If what you need is filed stored encrypted on disk... why is "use sodium" not a viable option for you?
Re:Hell Is Overconfident Developers Writing Encryption Code by umvi on Sunday February 02, 2025 @03:50AM (#42907253)
It might be in many cases, but not every language it seems has explicit sodium support. Golang for example, has this not-widely-used wrapper (https://github.com/jamesruan/sodium) maintained by some random guy which might not be desirable to use for a variety of reasons.
Re:Hell Is Overconfident Developers Writing Encryption Code by loup-vaillant on Monday February 03, 2025 @04:44AM (#42916581)
Foreign function interfaces aren't that scary. Any competent $lang developer ought to be able to read the docs and roll their own wrapper.