Comment by blintz

4 years ago

Cool project! This stuff is all possible thanks to the SubtleCrypto API (https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypt...), which became widespread in browsers in the last ~5 years. It's so great we don't have to use weird libraries (some with pretty gnarly side channel leakage) to do cryptography anymore.

It wouldn't be that crazy for the browser to do the encryption part for me, right? Like, what if in the 'save this page' dialog my browser actually did the encryption, and then generated this 'self-decrypting page' for me if I checked a box saying "encrypt with password"? Would be a nice way for regular non-technical people to encrypt things and send them to each other.

What level of confidence is there that all this API will work exactly as it works now after 30 years? I am concerned that they might at the very least deprecate and remove the ciphers used to encrypt my data in portable secret. Worse what if they remove support for the API? Then I am going to have HTML files with data I cannot decrypt anymore, right?

  • I don't know about 30 years but AES-256-GCM has implementations in multiple programming languages, e.g. it can be decrypted dependency free in Node.js >= 10. If browsers were to drop support (unlikely imo), there should be multiple options for decryption provided one has access to a runtime supporting AES-256-GCM decrypt. An older WASM'd version of PHP or python may even work.

    I have no use for this myself but wrote a quick Node.js script which accepts an html file created by this tool and prints messages to stdout or saves a file to decrypted.ext: https://gist.github.com/andrewmackrodt/e6a5a2ea7b22d74102ba7... - it's dependency free (no npm install dependencies) and tested with Node.js 10 and above.

    e.g. "docker run --rm -it -v "$PWD:/app" -w /app node:10-alpine portable-secret-decrypt.js example-image.html"

    When used with the Bart's drivers license it will create the decrypted file as decrypted.jpeg to the cwd.

  • You can always implement the decryption yourself, it’s not particularly difficult. But realistically, software doing so will continue to exist for a long time, and there will be extensive transition periods to migrate your secrets to a newer algorithm.

  • FWIW, symmetric encryption like AES-256 GCM is just astoundingly unlikely to be “broken” in the next ~20 years (or perhaps ever…)

    There’s more of a case for public-key stuff changing, but this doesn’t rely on anything public key.

  • Most cryptographic algorithms worth their salt have a pseudo code implementation on Wikipedia too. Just save the article along with the encrypted payload, bam future proofed :)

  • Web APIs are far more stable and reliable than you're giving them credit for. Do you have reason to believe that this API will break?

    No points will be awarded for citing jank that is a direct consequence of depending on proprietary, experimental, or non-standard stuff (like, "well, my Flash site worked in 2002, but now it doesn't").

I suppose that's a different implementation of the same 'hack' demo'd here, with the encryption carried out by an extension.