Skip to content

Commit 1154b43

Browse files
committed
update documentation: kdf caching and share link generation
1 parent 6cfd2ae commit 1154b43

File tree

8 files changed

+113
-5
lines changed

8 files changed

+113
-5
lines changed

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The content is encrypted with AES-256 in Python using PyCryptodome and decrypted
3838
* ~~localStorage option is rather useless now (being unsafe to start with). Fix it nevertheless by saving credentials instead of keys~~
3939
* Update/Restructure documentation
4040
* Quick share links
41-
* Implement keystore cache to speed up build time
41+
* ~~Implement keystore cache to speed up build time~~
4242

4343
## Todos for 3.1.x
4444
* optional server side keystore (allows throtteling)
@@ -60,6 +60,7 @@ The content is encrypted with AES-256 in Python using PyCryptodome and decrypted
6060
* [Add button](#Add-button)
6161
* [Tag encrypted page](#Tag-encrypted-page)
6262
* [Remember password](#Remember-password)
63+
* [Share link generation](#Share-link-generation)
6364
* [Modify generated pages](#Modify-generated-pages)
6465
* [Encrypt something](#Encrypt-something)
6566
* [Inject decrypt-form.tpl to theme](#Inject-decrypt-form.tpl-to-theme)
@@ -91,7 +92,7 @@ Install the package from source with pip:
9192
```bash
9293
cd mkdocs-encryptcontent-plugin/
9394
python setup.py sdist bdist_wheel
94-
pip install --force-reinstall --no-deps dist/mkdocs_encryptcontent_plugin-3.0.0.dev3-py3-none-any.whl
95+
pip install --force-reinstall --no-deps dist/mkdocs_encryptcontent_plugin-3.0.0.dev4-py3-none-any.whl
9596
```
9697

9798
Enable the plugin in your `mkdocs.yml`:
@@ -462,6 +463,29 @@ plugins:
462463
remember_prefix: secretsite_
463464
```
464465

466+
### Share link generation
467+
468+
It is possible to share valid credentials by adding them to the hash part of the URL.
469+
The plugin can also generate share links for certain pages if the metag tag `sharelink: true`
470+
is defined in markdown.
471+
It will use the first credential for the pages level or the pages password.
472+
The credentials for auto-generated links are base64url encoded.
473+
474+
```yaml
475+
plugins:
476+
- encryptcontent:
477+
sharelinks: True
478+
sharelinks_output: 'sharelinks.txt' # generated share links are saved here
479+
```
480+
> One condition applies: The user name must not contain the ":" character (Passwords may use that character).
481+
482+
However if `sharelinks: True` is enabled in the plugin configuration you can generate share links yourself:\
483+
`https://your-domain.com/your-site/protected-page/#!username:password` for user/password or\
484+
`https://your-domain.com/your-site/protected-page/#!password` for only password.
485+
486+
> Then another condition applies: If non-aphanumeric characters are used in user/password,
487+
> they need to be URLencoded (f.ex. %20 = space character). Some browsers may do that automatically (Do a copy/paste from the browsers address bar then).
488+
465489
title: Modify pages
466490

467491
## Modify generated pages
@@ -864,6 +888,22 @@ plugins:
864888
selfhost_dir: 'theme_overrides'
865889
```
866890

891+
#### KDF key generation caching
892+
893+
Either way (webcrypto or crypto-js) the [KDF](https://en.wikipedia.org/wiki/Key_derivation_function)
894+
key generation needs to be done for each credential.
895+
This may take some additional time when building the site, especially when there are many different ones.
896+
That's why these keys and salt are cached by default to a yaml file named "encryptcontent.cache".
897+
898+
```yaml
899+
plugins:
900+
- encryptcontent:
901+
cache_file: 'encryptcontent.cache' # change file name if needed
902+
```
903+
904+
Caching can be disabled by setting `cache_file: ''`.
905+
906+
867907
### File name obfuscation
868908
869909
Imagine your pages contain many images and you labeled them "1.jpg", "2.jpg" and so on for some reason.

documentation/docs/features/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,26 @@ plugins:
122122
remember_password: False
123123
remember_prefix: secretsite_
124124
```
125+
126+
### Share link generation
127+
128+
It is possible to share valid credentials by adding them to the hash part of the URL.
129+
The plugin can also generate share links for certain pages if the metag tag `sharelink: true`
130+
is defined in markdown.
131+
It will use the first credential for the pages level or the pages password.
132+
The credentials for auto-generated links are base64url encoded.
133+
134+
```yaml
135+
plugins:
136+
- encryptcontent:
137+
sharelinks: True
138+
sharelinks_output: 'sharelinks.txt' # generated share links are saved here
139+
```
140+
> One condition applies: The user name must not contain the ":" character (Passwords may use that character).
141+
142+
However if `sharelinks: True` is enabled in the plugin configuration you can generate share links yourself:\
143+
`https://your-domain.com/your-site/protected-page/#!username:password` for user/password or\
144+
`https://your-domain.com/your-site/protected-page/#!password` for only password.
145+
146+
> Then another condition applies: If non-aphanumeric characters are used in user/password,
147+
> they need to be URLencoded (f.ex. %20 = space character). Some browsers may do that automatically (Do a copy/paste from the browsers address bar then).

documentation/docs/features/security.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ plugins:
3131
selfhost_dir: 'theme_overrides'
3232
```
3333
34+
#### KDF key generation caching
35+
36+
Either way (webcrypto or crypto-js) the [KDF](https://en.wikipedia.org/wiki/Key_derivation_function)
37+
key generation needs to be done for each credential.
38+
This may take some additional time when building the site, especially when there are many different ones.
39+
That's why these keys and salt are cached by default to a yaml file named "encryptcontent.cache".
40+
41+
```yaml
42+
plugins:
43+
- encryptcontent:
44+
cache_file: 'encryptcontent.cache' # change file name if needed
45+
```
46+
47+
Caching can be disabled by setting `cache_file: ''`.
48+
49+
3450
### File name obfuscation
3551

3652
Imagine your pages contain many images and you labeled them "1.jpg", "2.jpg" and so on for some reason.

documentation/docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The content is encrypted with AES-256 in Python using PyCryptodome and decrypted
3434
* ~~localStorage option is rather useless now (being unsafe to start with). Fix it nevertheless by saving credentials instead of keys~~
3535
* Update/Restructure documentation
3636
* Quick share links
37-
* Implement keystore cache to speed up build time
37+
* ~~Implement keystore cache to speed up build time~~
3838

3939
## Todos for 3.1.x
4040
* optional server side keystore (allows throtteling)

documentation/docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Install the package from source with pip:
1313
```bash
1414
cd mkdocs-encryptcontent-plugin/
1515
python setup.py sdist bdist_wheel
16-
pip install --force-reinstall --no-deps dist/mkdocs_encryptcontent_plugin-3.0.0.dev3-py3-none-any.whl
16+
pip install --force-reinstall --no-deps dist/mkdocs_encryptcontent_plugin-3.0.0.dev4-py3-none-any.whl
1717
```
1818

1919
Enable the plugin in your `mkdocs.yml`:

documentation/encryptcontent.cache

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
kdf_iterations: 100000
2+
obfuscate:
3+
Crawler be gone!: 6c85ed748c5c1145fdc8a184e24d4b65cab4a2fdfa6d04271bd45d0d75252f10;fc94a75a1c37d86949e102c19c471661
4+
Kriechtier hau ab!: 5bb63ecf17cd85bb16f67cf62a6faa9bcf6d7cb1c3f357e1dadab310408edb81;a26ae8eefa2054396aed5e9945d647f0
5+
password:
6+
Password if PASSWORD2_FROM_ENV undefined or empty: cdcb0e2f5611344df32232f4924a865d8575829493e0c32fc0a877c44b615fed;0c10711b75c50efe30ea520cbf45d72e
7+
acid: 28819579c5f6f09ce77b3eca8b3ffa4638980388aba6092d2bd31431965efed9;5f6a7fe0244d998db0b93fdac8d9d215
8+
flashlight: e1f34579953e15abed57884ac190d21c16184eb8143c543c8caf79044273d86f;e53b6f4203b78ac25d87145a95cd16ff
9+
fryingpan: e9c73a136b667b2a8097002956bf251b17c5f72ab62fba558ba94df01a0e88ce;145ad52d80fdfddcf368620e6e42f30d
10+
"mu\xDF": b2b71e06b6d827dc547be0f13642293940fc37062dcbf25e4b05b1a7f8e7b025;3c6cffa4ccb427bc1a41ce70973a9c7d
11+
"m\xE4h": e40f992f4c2e665772f7ee472479c5769fc446c758712d5a6c2ba3f58f029f4d;df67e8df334cd52598802858529c1b26
12+
"m\xE9h": 1f034099dac99d3355b009964d36d3cd9038a5f2d579f2cf4625dccaa01a5e5d;0f43a7ea19bb0a91cde51a9f717bc02d
13+
"m\xF6h": ffe781807607b03beeaa2da3d61f9df24b296ef233bef4301846b488219762c3;d9ae674a7cc325233f1906915c8c107c
14+
"m\xFCh": 4c31fc043fc53597220e199302eb0c4271e979978a3c527d358eb85be7a6f8b6;fb1462be9891c5f042c9d8c0eb492df4
15+
passport: 0f0ab4b95363dfd03388fecb20f6e1cd247447ffeb51cfd01d757fb667234b6c;fbfa54194fe497b3cd4568edefe7049a
16+
sassy: a5f91c014f6e1a4058a76304c95286d0735bfcce1fcb18957cc368e6cadb467e;018b2abdaaa6a23b5ba2380e1940e1d0
17+
scientist: 657695a37e6271255afb9a89f4d229adcd86622261eee6fe63279909fe181114;0f5bc292cb6556858f6cd266fa4b49e7
18+
squirrel: a97a5457d52dd77268b41d8e682144eb70396d37bd83747aa327b116cd31bc89;d360001094f15126b41f0124c55bf5fc
19+
village: 3e86bec768a2cf5133a5d725386cd912d311b85ccaa083a93bd99fbe01127174;c32d42db5370e16d21211e3b9f2541e1
20+
userpass:
21+
alice: faa7dd08aff2d7392330b3f570387d5384613cc01141f4919acd63e304360acf;c96bc316cde85658b243a9dc1b4f935e
22+
bob: fdf567751b44a365f2e0f4dcf7f242c7e4d22b71a3ccd333ba6487fac85afe16;f5c92b67eba7bff15e5be06d3e7770b2
23+
carlos: a6e884623832f1b25c1fb93e17e414f5bc176df7148db4a791e1839af8e96811;37c94e8d06eec2da656e350564ed164b
24+
carol: b0ae627d2cd6809503098061e23afe38d770448cfc1eba3341a2fbfb0cec7f13;d77bd6fa44661ee2cf6c4bc4ac8b106e
25+
charlie: 3434c70d48452b0416efe9dd1a8e1d51556190a149a87a9876f3cf156d19db52;bea92c4320faa6351e01a3f1cd79c59e
26+
dan: aca8328553babc6b5701b35784f57db73904a1475efd20dfdb26db535c818687;89b4866e04f0b06ba8dedabe3bf3a634
27+
dave: a2f6a86312d8dfd58fdd906fec79a499f48c2b7548a5a9962d75eb6558afcef1;f8532f4785686e438f2bc8f2627483fc
28+
david: 41f3725e4e57467100e76b6dfa9b7dcd6b5aaa506e7cea9274e999110a3ce6f1;35bb13beb676f6e34d6bfbc3e24a6c45

documentation/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ plugins:
138138
#kdf_pow: 4
139139
webcrypto: true
140140
sign_files: 'encryptcontent-plugin.json'
141+
cache_file: 'encryptcontent.cache'
141142
hash_filenames:
142143
extensions:
143144
- 'png'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def read(fname):
1111

1212
setup(
1313
name='mkdocs-encryptcontent-plugin',
14-
version='3.0.0.dev3',
14+
version='3.0.0.dev4',
1515
author='unverbuggt',
1616
author_email='[email protected]',
1717
description='A MkDocs plugin that encrypt/decrypt markdown content with AES',

0 commit comments

Comments
 (0)