I want to sign and encrypt some binaries that will be distributed to users of an embedded device. The users will upload these binaries to the device, which will accept them if and only if they are signed and encrypted with the correct keys. The devices are relatively fast and the binaries relatively small, so performance is probably not a big issue.
I'd like to hear some suggestions on what crate(s) I should look into for this task.
Some background here, click to expand.
The motivation for requiring a signature is to ensure that only binaries created by me can be run on the device, both to avoid potential damage if a malicious binary was uploaded and to avoid that the device performs operations that it is not designed/authorized to perform.
The motivation for requiring encryption is two fold: First, to hinder reverse engineering of the binaries; Second, to ensure that the binaries can be executed only on devices that have the correct key pre-programmed by me.
I'd like to mention that it's OK if a user very skilled in the arts of reverse engineering and cryptography can bypass these restrictions. I want a reasonable amount of protection against a "typical user", who might even spend a few hours googling around and trying different approaches before giving up and going on with their life. I'm not trying to protect against state-sponsored attacks, and nobody's life is depending on these protections not being broken.
I'm happy to provide more context if needed.
I know of the RustCrypto project, but I find it hard to navigate through the "dozens of popular crates" they provide, hence this post of mine. Especially, my understanding is that some of those crates are low level and not intended for direct use, so I should use something higher level built on top of them instead.
In another project, I've used ed25519-dalek for signing and verification. I've also briefly played with chacha20poly1305 for symmetric encryption, but nothing more than trying out a few examples. So my current baseline approach would be to combine those two crates, using ed25519-dalek
for the signature part and chacha20poly1305
for the encryption part.
Is this a reasonable approach? Are there any other crates you would recommend instead? Is there an approach that would provide both signature and encryption at once?
Thank you for your time and help!