|
1 | | -# TrezorSymmetricFileEncryption |
2 | | -Use your Trezor device to symmetrically encrypt and decrypt files |
| 1 | +#  |
| 2 | + |
| 3 | +# Trezor Symmetric File Encryption |
| 4 | + |
| 5 | +**:star: :star: :star: Use your [Trezor](http://www.trezor.io/) device to symmetrically encrypt and decrypt files :star: :star: :star:** |
| 6 | + |
| 7 | +**:lock: :unlock: :key: Hardware-backed file encryption with Trezor :key: :unlock: :lock:** |
| 8 | + |
| 9 | +`TrezorSymmetricFileEncryption` is a small, simple tool that |
| 10 | +allows you to symmetrically encrypt and decrypt files. |
| 11 | + |
| 12 | +Note that it is software, currently in alpha stage. |
| 13 | + |
| 14 | +# Features |
| 15 | + |
| 16 | + * Trezor convenience |
| 17 | + * Trezor security |
| 18 | + * One Trezor for all your needs: gpg, ssh, **symmetric encryption**, etc. |
| 19 | + * Encrypt your files for your use, guarantee your privacy |
| 20 | + * Requires confirmation button click on Trezor device to perform decrypt operation. |
| 21 | + * It supports both GUI mode and Terminal mode. |
| 22 | + * Even in Terminal mode the PIN is entered through a small GUI window. |
| 23 | + For safety we also recommend to enter the passphrase through a small GUI |
| 24 | + window even in Terminal mode as it is not a good practice to place a |
| 25 | + passphrase on the command line. |
| 26 | + * Since it is a simple script it is easy to automate workflows |
| 27 | + * Optionally obfuscates/encrypts filenames on encryption to hide meta-data (i.e. the file names) |
| 28 | + * Use it before and after you store sensitive information on DropBox or Google Drive |
| 29 | + |
| 30 | +# Screenshot |
| 31 | + |
| 32 | +Below a sample screenshot. More screenshots [here](https://github.com/8go/TrezorSymmetricFileEncryption/tree/master/screenshots). |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +# Build and runtime requirements |
| 37 | + |
| 38 | + * Use of passphrases must have been already enabled on your [Trezor](https://www.trezor.io) device. |
| 39 | + * [Python](https://www.python.org/) |
| 40 | + * PyCrypto |
| 41 | + * PyQt4 |
| 42 | + * [trezorlib from python-trezor](https://github.com/trezor/python-trezor) |
| 43 | + |
| 44 | +# Building |
| 45 | + |
| 46 | +Even though the whole code is in Python, there are few Qt `.ui` form files that |
| 47 | +need to be transformed into Python files. There is `Makefile`, you just need to run |
| 48 | + |
| 49 | + make |
| 50 | + |
| 51 | +## Build requirements |
| 52 | + |
| 53 | +PyQt4 development tools are necessary, namely `pyuic4` (look for packages named |
| 54 | +like `pyqt4-dev-tools` or `PyQt4-devel`). |
| 55 | + |
| 56 | +# Running |
| 57 | + |
| 58 | +Run: |
| 59 | + |
| 60 | + python TrezorSymmetricFileEncryption.py |
| 61 | + |
| 62 | +Run-time command line options are |
| 63 | + |
| 64 | +``` |
| 65 | +TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-n] [-t] [-o | -e | -d] [-p <passphrase>] <files> |
| 66 | + -v, --verion ... optional ... print the version number |
| 67 | + -h, --help ... optional ... print short help text |
| 68 | + -l, --logging ... optional ... set logging level, integer from 1 to 5, 1=full logging, 5=no logging |
| 69 | + -t, --terminal ... optional ... run in the terminal, except for PIN query |
| 70 | + and possibly a Passphrase query this avoids the GUI |
| 71 | + -n, --nameonly ... optional ... just decrypt an obfuscated filename, |
| 72 | + does not decrypt the file itself, incompaible with `-o` and `-e` |
| 73 | + -d, --decrypt ... optional ... decrypt file |
| 74 | + -e, --encrypt ... optional ... encrypt file and keep plaintext file name for output (appends .tsfe suffix) |
| 75 | + -o, --obfuscatedencrypt . optional ... encrypt file and obfuscate file name of output |
| 76 | + -p, --passphrase ... optional ... master passphrase used for Trezor |
| 77 | + It is recommended that you do not use this command line option |
| 78 | + but rather give the passphrase through a small window interaction. |
| 79 | + <files> ... one or multiple files to be encrypted or decrypted |
| 80 | +
|
| 81 | + By default it will use a GUI. |
| 82 | +
|
| 83 | + You can force it to avoid the GUI by using `-t`, the Terminal mode. |
| 84 | + If you specify filename, possibly some `-o`, `-e`, or `-d` option, then |
| 85 | + only PIN and Passphrase will be collected through windows. |
| 86 | +
|
| 87 | + Using the GUI has the advantage that no passphrase has to be specified in the command line. |
| 88 | + So, using the GUI is safer. |
| 89 | +
|
| 90 | + Most of the time TrezorSymmetricFileEncryption can detect automatically if |
| 91 | + it needs to decrypt or encrypt by analyzing the given input file name. |
| 92 | + So, in most of the cases you do not need to specify any |
| 93 | + de/encryption option. |
| 94 | + TrezorSymmetricFileEncryption will simply do the right thing. |
| 95 | + In the very rare case that TrezorSymmetricFileEncryption determines |
| 96 | + the wrong encrypt/decrypt operation you can force it to use the right one |
| 97 | + by using either `-e` or `-d` or selecting the appropriate option in the GUI. |
| 98 | +
|
| 99 | + If TrezorSymmetricFileEncryption automatically choses the encryption |
| 100 | + option for you, it will chose by default the `-e`, and create |
| 101 | + plaintext encrypted files with an `.tsfe` suffix. |
| 102 | +
|
| 103 | + If you want the output file name to be obfuscated you |
| 104 | + must use the `-o` (obfuscate) flag or select that option in the GUI. |
| 105 | +``` |
| 106 | + |
| 107 | +# FAQ - Frequently Asked Questions |
| 108 | + |
| 109 | +**Question:** Shouldn't there be two executables? One for encrypting |
| 110 | +and another one for decrypting? |
| 111 | + |
| 112 | +**Answer:** No. There is only one Python file which does both encryption and decryption. |
| 113 | +- - - |
| 114 | +**Question:** What are the command line options? |
| 115 | + |
| 116 | +**Answer:** See description above. But in the vast majority of cases you |
| 117 | +do not need to set or use any command line options. |
| 118 | +TrezorSymmetricFileEncryption will in most cases automatically detect |
| 119 | +if it needs to encrypt or decrypt. |
| 120 | +- - - |
| 121 | +**Question:** Are there any RSA keys involved somewhere? |
| 122 | + |
| 123 | +**Answer:** No. There are no RSA keys, there is no asymmetric encryption. |
| 124 | +- - - |
| 125 | +**Question:** Can I send encrypted files to my friends and have them decrypt them? |
| 126 | + |
| 127 | +**Answer:** No. Only you have the Trezor that can decrypt the files. |
| 128 | +**You** encrypt the files, and **you** decrypt them later. |
| 129 | +TrezorSymmetricFileEncryption is not built for sharing. |
| 130 | +For sharing encrypted files use asymmetric encryption |
| 131 | +like [gpg](https://gnupg.org/). |
| 132 | +By the way, Trezor supports gpg encryption/decryption. |
| 133 | +In short, only the holder of the Trezor who also knows the PIN and the |
| 134 | +TrezorSymmetricFileEncryption master password (= Trezor passphrase) can |
| 135 | +decrypt the file(s). |
| 136 | +- - - |
| 137 | +**Question:** What crypto technology is used? |
| 138 | + |
| 139 | +**Answer:** At the heart of it all is the |
| 140 | +python-trezor/trezorlib/client.py/encrypt_keyvalue() |
| 141 | +function of the Python client library of [Trezor](https://www.trezor.io) |
| 142 | +and AES-CBC encryption. |
| 143 | +- - - |
| 144 | +**Question:** Is there a config file or a settings file? |
| 145 | + |
| 146 | +**Answer:** No, there are no config and no settings files. |
| 147 | +- - - |
| 148 | +**Question:** Does TrezorSymmetricFileEncryption require online connectivity, |
| 149 | +Internet access? |
| 150 | + |
| 151 | +**Answer:** No. |
| 152 | +- - - |
| 153 | +**Question:** How many files are there? |
| 154 | + |
| 155 | +**Answer:** If you have Python installed, then there are just a |
| 156 | +handful of Python files. Alternatively, if you don't want to |
| 157 | +install Python one can create a single-file-executable |
| 158 | +with tools like [pyinstaller](www.pyinstaller.org). In that case you just have a |
| 159 | +single-file-executablefile. |
| 160 | +- - - |
| 161 | +**Question:** In which language is TrezorSymmetricFileEncryption written? |
| 162 | + |
| 163 | +**Answer:** [Python](https://www.python.org/). |
| 164 | +- - - |
| 165 | +**Question:** Do I need to have a [Trezor](https://www.trezor.io/) in |
| 166 | +order to use TrezorSymmetricFileEncryption? |
| 167 | + |
| 168 | +**Answer:** Yes, a Trezor is required. |
| 169 | +- - - |
| 170 | +**Question:** Is there any limit on the file size for encryption or decryption? |
| 171 | + |
| 172 | +**Answer:** Yes. Currently it is 2G minus a few bytes. On old computers |
| 173 | +with very little memory, it might be less than 2G due to memory limitations. |
| 174 | +- - - |
| 175 | +**Question:** Can I see the source code? |
| 176 | + |
| 177 | +**Answer:** Yes, this is an open source software project. |
| 178 | +You can find and download all source code from |
| 179 | +[Github](https://github.com/8go/TrezorSymmetricFileEncryption) or |
| 180 | +any of its forks. |
| 181 | +- - - |
| 182 | +**Question:** Does the TrezorSymmetricFileEncryption contain ads? |
| 183 | + |
| 184 | +**Answer:** No. |
| 185 | +- - - |
| 186 | +**Question:** Does TrezorSymmetricFileEncryption cost money? |
| 187 | + |
| 188 | +**Answer:** No. It is free, libre, and open source. |
| 189 | +- - - |
| 190 | +**Question:** Does TrezorSymmetricFileEncryption call home? |
| 191 | +Send any information anywhere? |
| 192 | + |
| 193 | +**Answer:** No. Never. You can also use it on an air-gapped computer if you |
| 194 | +want to. It does not contain any networking code at all. It does not update |
| 195 | +itself automatically. It cannot send anything anywhere. |
| 196 | +- - - |
| 197 | +**Question:** Does TrezorSymmetricFileEncryption have a backdoor? |
| 198 | + |
| 199 | +**Answer:** No. Read the source code to convince yourself. |
| 200 | +- - - |
| 201 | +**Question:** How can I know that TrezorSymmetricFileEncryption does not contain a virus? |
| 202 | + |
| 203 | +**Answer:** Download the source from |
| 204 | +[Github](https://github.com/8go/TrezorSymmetricFileEncryption) |
| 205 | +and inspect the source code for viruses. Don't download it from unreliable sources. |
| 206 | +- - - |
| 207 | +**Question:** Can someone steal or duplicate the key used for encryption or decryption? |
| 208 | + |
| 209 | +**Answer:** No, the key never leaves the Trezor. |
| 210 | +- - - |
| 211 | +**Question:** Can a keyboard logger steal a key? |
| 212 | + |
| 213 | +**Answer:** No, it never leaves the Trezor. |
| 214 | +- - - |
| 215 | +**Question:** Can a screen grabber or a person looking over my shoulder steal a key? |
| 216 | + |
| 217 | +**Answer:** No, it never leaves the Trezor. |
| 218 | +- - - |
| 219 | +**Question:** What can be stolen? How can it be stolen? |
| 220 | + |
| 221 | +**Answer:** A virus or malware could steal your plain text file before you |
| 222 | +encrypt it or after you decrypt it. Once you have a safe encrypted copy |
| 223 | +you can consider shredding the plain text copy of the file(s). For extremely |
| 224 | +sensitive information consider using an air-gapped computer or |
| 225 | +a [LiveDvd OS](https://en.wikipedia.org/wiki/Live_DVD) if you have one available. |
| 226 | +- - - |
| 227 | +**Question:** Is TrezorSymmetricFileEncryption portable? |
| 228 | + |
| 229 | +**Answer:** Yes. It is just a handful of Python files |
| 230 | +or a single-file-executable. |
| 231 | +You can move it around via an USB stick, SD card, email or cloud service. |
| 232 | +- - - |
| 233 | +**Question:** Can I contribute to the project? |
| 234 | + |
| 235 | +**Answer:** Yes. It is open source. |
| 236 | +Go to [Github](https://github.com/8go/TrezorSymmetricFileEncryption). |
| 237 | +- - - |
| 238 | +**Question:** What if I lose my Trezor and my 24 Trezor seed words or |
| 239 | +my TrezorSymmetricFileEncryption master password (= Trezor passphrase)? |
| 240 | + |
| 241 | +**Answer:** Then you will not be able to decrypt your previously encrypted |
| 242 | +file. For practical purposes you have lost those files. Brute-forcing is |
| 243 | +not a viable work-around. |
| 244 | +- - - |
| 245 | +**Question:** What if I lose my Trezor or someone steals my Trezor? |
| 246 | + |
| 247 | +**Answer:** As long as the thief cannot guess your TrezorSymmetricFileEncryption master |
| 248 | +password (= Trezor passphrase) the thief cannot use it to decrypt your files. |
| 249 | +A good PIN helps too. If the thief can guess your PIN and thereafter is able |
| 250 | +to brute-force your TrezorSymmetricFileEncryption master password |
| 251 | +(= Trezor passphrase) then he can decrypt your files. So, use a good PIN and |
| 252 | +a good passphrase and you will be safe. After losing your Trezor you will need |
| 253 | +to get a new Trezor to decrypt your files. Decryption without a Trezor device |
| 254 | +could be done in pure software |
| 255 | +knowing the 24 seed words and the passphrase, but that software has not been |
| 256 | +written yet. |
| 257 | +- - - |
| 258 | +**Question:** On which platforms, operating systems is |
| 259 | +TrezorSymmetricFileEncryption available? |
| 260 | + |
| 261 | +**Answer:** On all platforms, operating systems where |
| 262 | +[Python](https://www.python.org/) and PyQt4 is available: Windows, Linux, Unix, |
| 263 | +Mac OS X. Internet searches show Python for Android and iOS, |
| 264 | +but it has not been investigated or tested on Android or iOS. |
| 265 | +Testing has only been done on Linux. |
| 266 | +- - - |
| 267 | +**Question:** Is it fast? |
| 268 | + |
| 269 | +**Answer:** It is reasonably fast; like any AES implementation. |
| 270 | +Encryypting or decrypting a 1G file takes about 15 seconds, but |
| 271 | +your mileage may vary as speed depends on CPU and disk speed. |
| 272 | +- - - |
| 273 | +**Question:** Are there any warranties or guarantees? |
| 274 | + |
| 275 | +**Answer:** No, there are no warranties or guarantees whatsoever. |
| 276 | +- - - |
| 277 | +**Question:** More questions? |
| 278 | + |
| 279 | +**Answer:** Let us know. |
| 280 | +- - - |
| 281 | + |
| 282 | +< > on :octocat: with :heart: |
0 commit comments