You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-23Lines changed: 27 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
# StatiCrypt
4
4
5
-
StatiCrypt uses AES-256 to encrypt your HTML file with your passphrase and return a static page including a password prompt and the javascript decryption logic that you can safely upload anywhere (see [what the page looks like](https://robinmoisson.github.io/staticrypt/example/example_encrypted.html)).
5
+
StatiCrypt uses AES-256 to encrypt your HTML file with your long password and return a static page including a password prompt and the javascript decryption logic that you can safely upload anywhere (see [what the page looks like](https://robinmoisson.github.io/staticrypt/example/example_encrypted.html)).
6
6
7
7
This means you can **password protect the content of your _public_ static HTML file, without any back-end** - serving it over Netlify, GitHub pages, etc. (see the detail of [how it works](#how-staticrypt-works)).
8
8
@@ -27,41 +27,41 @@ You can then run it with `npx staticrypt ...`. You can also install globally wit
27
27
**Encrypt a file:** Encrypt `test.html` and create a `test_encrypted.html` file (add `-o my_encrypted_file.html` to change the name of the output file):
28
28
29
29
```bash
30
-
staticrypt test.html MY_PASSPHRASE
30
+
staticrypt test.html MY_LONG_PASSWORD
31
31
```
32
32
33
-
**Encrypt a file with the passphrase in an environment variable:** set your passphrase in the `STATICRYPT_PASSWORD` environment variable ([`.env` files](https://www.npmjs.com/package/dotenv#usage) are supported):
33
+
**Encrypt a file with the password in an environment variable:** set your long password in the `STATICRYPT_PASSWORD` environment variable ([`.env` files](https://www.npmjs.com/package/dotenv#usage) are supported):
34
34
35
35
```bash
36
-
# the passphrase is in the STATICRYPT_PASSWORD env variable
36
+
# the password is in the STATICRYPT_PASSWORD env variable
37
37
staticrypt test.html
38
38
```
39
39
40
40
**Encrypt a file and get a shareable link containing the hashed password** - you can include your file URL or leave blank:
41
41
42
42
```bash
43
43
# you can also pass '--share' without specifying the URL to get the `?staticrypt_pwd=...`
**Encrypt all html files in a directory** and replace them with encrypted versions (`{}` will be replaced with each file name by the `find` command - if you wanted to move the encrypted files to an `encrypted/` directory, you could use `-o encrypted/{}`):
-i, --instructions Special instructions to display to the user.
80
80
[string] [default: ""]
81
81
--label-error Error message to display on entering wrong
82
-
passphrase. [string] [default: "Bad password!"]
82
+
password. [string] [default: "Bad password!"]
83
83
--noremember Set this flag to remove the "Remember me"
84
84
checkbox. [boolean] [default: false]
85
85
-o, --output File name/path for the generated encrypted file.
86
86
[string] [default: null]
87
-
--passphrase-placeholder Placeholder to use for the passphrase input.
87
+
--passphrase-placeholder Placeholder to use for the password input.
88
88
[string] [default: "Password"]
89
89
-r, --remember Expiration in days of the "Remember me" checkbox
90
-
that will save the (salted + hashed) passphrase
91
-
in localStorage when entered by the user.
92
-
Default: "0", no expiration.
93
-
[number] [default: 0]
90
+
that will save the (salted + hashed) password in
91
+
localStorage when entered by the user. Default:
92
+
"0", no expiration. [number] [default: 0]
94
93
--remember-label Label to use for the "Remember me" checkbox.
95
94
[string] [default: "Remember me"]
96
95
-s, --salt Set the salt manually. It should be set if you
@@ -104,7 +103,10 @@ The passphrase argument is optional if `STATICRYPT_PASSWORD` is set in the envir
104
103
value to append "?staticrypt_pwd=<hashed_pwd>",
105
104
or leave empty to display the hash to append.
106
105
[string]
106
+
--short Hide the "short password" warning.
107
+
[boolean] [default: false]
107
108
-t, --title Title for the output HTML page.
109
+
[string] [default: "Protected Page"]
108
110
109
111
110
112
## HOW STATICRYPT WORKS
@@ -119,9 +121,11 @@ So it basically encrypts your page and puts everything in a user-friendly way to
119
121
120
122
### Is it secure?
121
123
122
-
Simple answer: your file content has been encrypted with AES-256 (CBC), a popular and strong encryption algorithm, you can now upload it in any public place and no one will be able to read it without the password. So yes, if you used a good password it should be pretty secure.
124
+
Simple answer: your file content has been encrypted with AES-256 (CBC), a popular and strong encryption algorithm, you can now upload it in any public place and no one will be able to read it without the password. So if you used a long, strong password, then yes it should be pretty secure.
123
125
124
-
That being said, actual security always depends on a number of factors and on the threat model you want to protect against. Because your full encrypted file is accessible client side, brute-force/dictionary attacks would be trivial to do at a really fast pace: **use a long, unusual password**. You can read a discussion on CBC mode and how appropriate it is in the context of StatiCrypt in [#19](https://github.com/robinmoisson/staticrypt/issues/19).
126
+
That being said, actual security always depends on a number of factors and on the threat model you want to protect against. Because your full encrypted file is accessible client side, brute-force/dictionary attacks would be easy to do at a really fast pace: **use a long, unusual password**. We recommend 16+ alphanum characters, [Bitwarden](https://bitwarden.com/) is a great open-source password manager if you don't have one already.
127
+
128
+
On the technical aspects: we use AES in CBC mode (see a discussion on why it's appropriate for StatiCrypt in [#19](https://github.com/robinmoisson/staticrypt/issues/19)) and 15k PBKDF2 iterations (it will be 600k when we'll switch to WebCrypto, read a detailed report on why these numbers in [#159](https://github.com/robinmoisson/staticrypt/issues/159)).
125
129
126
130
**Also, disclaimer:** I am not a cryptographer - the concept is simple and I try my best to implement it correctly but please adjust accordingly: if you are an at-risk activist or have sensitive crypto data to protect, you might want to use something else.
127
131
@@ -149,9 +153,9 @@ The salt isn't secret, so you don't need to worry about hiding the config file.
149
153
150
154
### How does the "Remember me" checkbox work?
151
155
152
-
The CLI will add a "Remember me" checkbox on the password prompt by default (`--noremember` to disable). If the user checks it, the (salted + hashed) passphrase will be stored in their browser's localStorage and the page will attempt to auto-decrypt when they come back.
156
+
The CLI will add a "Remember me" checkbox on the password prompt by default (`--noremember` to disable). If the user checks it, the (salted + hashed) password will be stored in their browser's localStorage and the page will attempt to auto-decrypt when they come back.
153
157
154
-
If no value is provided the stored passphrase doesn't expire, you can also give it a value in days for how long should the store value be kept with `-r NUMBER_OF_DAYS`. If the user reconnects to the page after the expiration date the stored value will be cleared.
158
+
If no value is provided the stored password doesn't expire, you can also give it a value in days for how long should the store value be kept with `-r NUMBER_OF_DAYS`. If the user reconnects to the page after the expiration date the stored value will be cleared.
155
159
156
160
#### "Logging out"
157
161
@@ -163,14 +167,14 @@ This allows encrypting multiple page on a single domain with the same password:
163
167
164
168
#### Is the "Remember me" checkbox secure?
165
169
166
-
In case the value stored in the browser becomes compromised an attacker can decrypt the page, but because it's stored salted and hashed this should still protect against password reuse attacks if you've used the passphrase on other websites (of course, please use a unique passphrase nonetheless).
170
+
In case the value stored in the browser becomes compromised an attacker can decrypt the page, but because it's stored salted and hashed this should still protect against password reuse attacks if you've used the password on other websites (of course, please use a long, unique password nonetheless).
167
171
168
172
## Contributing
169
173
170
174
### 🙏 Thank you!
171
175
172
176
-[@AaronCoplan](https://github.com/AaronCoplan) for bringing the CLI to life
173
-
-[@epicfaace](https://github.com/epicfaace) & [@thomasmarr](https://github.com/thomasmarr) for sparking the caching of the passphrase in localStorage (allowing the "Remember me" checkbox)
177
+
-[@epicfaace](https://github.com/epicfaace) & [@thomasmarr](https://github.com/thomasmarr) for sparking the caching of the password in localStorage (allowing the "Remember me" checkbox)
174
178
-[@hurrymaplelad](https://github.com/hurrymaplelad) for refactoring a lot of the code and making the project much more pleasant to work with
0 commit comments