Title: | Encrypt Html Reports Using 'Libsodium' |
---|---|
Description: | Create encrypted html files that are fully self contained and do not require any additional software. Using the package you can encrypt arbitrary html files and also directly create encrypted 'rmarkdown' html reports. |
Authors: | Dirk Schumacher [aut, cre, cph], Jannis R. [aut, cph] |
Maintainer: | Dirk Schumacher <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.1.9000 |
Built: | 2024-11-21 04:20:24 UTC |
Source: | https://github.com/dirkschumacher/encryptedrmd |
This function takes an html file, encrypts the complete file using sodium::data_encrypt
and a given key. It then injects the encrypted content into an html template that
contains the sodium
decryption code compiled to javascript.
The resulting file is fully self contained as it can decrypt itself.
When the user enters the correct key, the DOM of the html files gets replaced with
the initially encrypted html file.
encrypt_html_file( path, output_path = paste0(path, ".enc.html"), key = sodium::random(32L), message_key = TRUE, write_key_file = FALSE, output_template_path = system.file("html-template.html", package = "encryptedRmd") )
encrypt_html_file( path, output_path = paste0(path, ".enc.html"), key = sodium::random(32L), message_key = TRUE, write_key_file = FALSE, output_template_path = system.file("html-template.html", package = "encryptedRmd") )
path |
the file you want to encrypt |
output_path |
optional, the output path |
key |
optional, the encryption key |
message_key |
optional, print the encryption key to the console |
write_key_file |
optional, write a key file in the same directory |
output_template_path |
a path to the output template. The output template needs have the same html form elements (same ids) and the same placeholders as the default template. Everything else can be customized. |
Warning: You are using this at your own risk. Make sure your encryption key is strong enough. For serious use cases, please also review the code of the functions. Any feedback is appreciated. This is an early package version.
The key used to encrypt the file as an invisible raw vector.
The package follows the same approach as the node module self-decrypting-html-page. The decryption code is based on a number of great node modules. All licenses are also bundled with each encrypted html file.
In addition to a standard html file this rmarkdown
format also creates
an encrypted version together with the key as two separate files.
encrypted_html_document(...)
encrypted_html_document(...)
... |
all parameters are passed to |
Two files are created:
This is the password protected file.
This file contains the key with which the report was encrypted.
Warning: You are using this at your own risk. Make sure your encryption key is strong enough. For serious use cases, please also review the code of the functions. Any feedback is appreciated. This is an early package version. Please only share the key file with trusted parties
R Markdown output format to pass to render
encrypt_html_file
for more information on the encryption.