Demo of an RMarkdown output that's encrypted and hosted online.
I used Dirk Schumacher's {encryptedRmd} R package to render an R Markdown file to encrypted HTML, which I've hosted online via GitHub Pages. It requires a decryption key if you want to download it.
That means I can give the URL and the decryption key to someone and they can download the contents. If you don't have the decryption key, you can't view it.
Read more in the accompanying blog post.
For this demo, you can find the encrypted HTML output here: https://matt-dray.github.io/encrypt-rmd-test/encrypt-test.html.enc.html
You'll be prompted for a key, which for this example is: 9ebf5d40b061c59330b9fce16703e4c2fb2fbf90a773996e43e49d562ea17039
As noted in the {encryptedRmd} README: use at your own risk.
I did the following to create the contents of this repo:
- Install {encryptedRmd} from CRAN with
install.packages("encryptedRmd")
(v0.2.1 at time of writing) - Write an R Markdown file with the
output:
field in the YAML set toencryptedRmd::encrypted_html_document
- Knit the file to render (i) an unencrypted HTML, (ii) an encrypted HTML, and (iii) a decryption key
- Commit and push the encrypted file to GitHub and serve it via GitHub Pages (go to 'Settings' > 'Pages' from the GitHub repo)
Of course, you should add the R Markdown file, the unencrypted HTML and the decryption key to your .gitignore. I've retained all the files in this repo for demonstration purposes.
I created the R Markdown file encrypt-test.Rmd
in the docs/
folder of this repo. When knitted, it generated:
encrypt-test.html
, an unencrypted HTML rendered from the Rmdencrypt-test.enc.html
, anenc
rypted HTML rendered from the Rmdencrypt-test.end.html.key
, the key that must be used to decrypt the encrypted HTML