Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Note that it is software, currently in alpha stage.

# Screenshot

Below a sample screenshot. More screenshots [here](https://github.com/8go/TrezorSymmetricFileEncryption/tree/master/screenshots).
Below a sample screenshot. More screenshots [here](screenshots).

![screenshot](https://github.com/8go/TrezorSymmetricFileEncryption/blob/master/screenshots/screenshot_TrezorSymmetricFileEncryption_mainWindow2.version03b.png)
![screenshot](screenshots/screenshot_TrezorSymmetricFileEncryption_mainWindow6.version04b.png)

# Build and runtime requirements

Expand Down Expand Up @@ -74,7 +74,7 @@ Run:
Run-time command line options are

```
TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o | -e | -d | -n] [-p <passphrase>] <files>
TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o | -e | -d | -m | -n] [-p <passphrase>] <files>
-v, --verion
print the version number
-h, --help
Expand Down Expand Up @@ -113,9 +113,11 @@ TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o
only relevant for `-e` and `-o`; ignored in all other cases.
Primarily useful for testing.
-w, --wipe
shred the plaintext file after encryption;
only relevant for `-e` and `-o`; ignored in all other cases.
Use with caution. May be used together with `-s`.
shred the inputfile after creating the output file
i.e. shred the plaintext file after encryption or
shred the encrypted file after decryption;
only relevant for `-d`, `-e` and `-o`; ignored in all other cases.
Use with extreme caution. May be used together with `-s`.
<files>
one or multiple files to be encrypted or decrypted

Expand Down Expand Up @@ -164,6 +166,10 @@ TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o
# encrypt contract and obfuscate output producing e.g. TQFYqK1nha1IfLy_qBxdGwlGRytelGRJ
TrezorSymmetricFileEncryption.py -o contract.doc

# encrypt contract and obfuscate output producing e.g. TQFYqK1nha1IfLy_qBxdGwlGRytelGRJ
# performs safety check and then shreds contract.doc
TrezorSymmetricFileEncryption.py -e -o -s -w contract.doc

# decrypt contract producing contract.doc
TrezorSymmetricFileEncryption.py contract.doc.tsfe

Expand All @@ -172,6 +178,18 @@ TrezorSymmetricFileEncryption.py [-v] [-h] [-l <level>] [-t] [-2] [-s] [-w] [-o

# shows plaintext name of encrypted file, e.g. contract.doc
TrezorSymmetricFileEncryption.py -n TQFYqK1nha1IfLy_qBxdGwlGRytelGRJ

Keyboard shortcuts of GUI:
Apply, Save: Control-A, Control-S
Cancel, Quit: Esc, Control-Q
Copy to clipboard: Control-C
Version, About: Control-V
Set encrypt operation: Control-E
Set decrypt operation: Control-D
Set obfuscate option: Control-O
Set twice option: Control-2
Set safety option: Control-T
Set wipe option: Control-W
```

# Testing
Expand Down
36 changes: 18 additions & 18 deletions TrezorSymmetricFileEncryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def chooseDevice(self, devices):
deviceStr = dialog.chosenDeviceStr()
return HidTransport([deviceStr, None])

def showGui(trezor, settings, fileMap, logger, feedback):
def showGui(trezor, settings, fileMap, logger):
"""
Initialize, ask for encrypt/decrypt options,
ask for files to be decrypted/encrypted,
Expand All @@ -161,27 +161,20 @@ def showGui(trezor, settings, fileMap, logger, feedback):
items selected in GUI
"""
dialog = Dialog(trezor, settings, fileMap, logger)
settings.guiExists = True
settings.settings2Gui(dialog, trezor)
if settings.logger.getEffectiveLevel() <= logging.INFO:
dialog.appendDescription("<br>Trezor label: " + trezor.features.label)
if settings.WArg and settings.logger.getEffectiveLevel() <= logging.WARN:
dialog.appendDescription("<br>Warning: The option `--wipe` is set. Plaintext files will "
"be shredded after encryption. Abort if you are uncertain or don't understand.")
processing.reportLogging("Trezor label: %s" % trezor.features.label, logging.INFO,
"Trezor IO", settings, logger, dialog)
if not dialog.exec_():
settings.guiExists = False
processing.reportLogging("Shutting down due to user request "
"(Done/Quit was called).", logging.DEBUG,
"GUI IO", settings, logger)
"GUI IO", settings, logger, None)
sys.exit(4) # Esc or exception
settings.guiExists = False
settings.gui2Settings(dialog,trezor)

# root

logging.basicConfig(stream=sys.stderr, level=basics.LOGGINGLEVEL)
logger = logging.getLogger('tsfe')
feedback = processing.Feedback()

app = QtGui.QApplication(sys.argv)

Expand All @@ -204,20 +197,27 @@ def showGui(trezor, settings, fileMap, logger, feedback):

trezor.clear_session()

if settings.TArg:
logger.info("Trezor label: %s", trezor.features.label)

fileMap = file_map.FileMap(trezor,logger)

# if everything is specified in the command line then do not call the GUI
if ((settings.PArg is None) or (len(settings.inputFiles) <= 0)) and (not settings.TArg):
# something was not specified, so we call the GUI
showGui(trezor, settings, fileMap, logger, feedback)
showGui(trezor, settings, fileMap, logger)
else:
logger.info("Everything was specified or --terminal was set, "
"hence the GUI will not be called.")
processing.reportLogging("Trezor label: %s" % trezor.features.label, logging.INFO,
"Trezor IO", settings, logger, None)
processing.reportLogging("Everything was specified or --terminal was set, "
"hence the GUI will not be called.", logging.INFO,
"Trezor IO", settings, logger, None)
if settings.WArg:
processing.reportLogging("The option `--wipe` is set. In case of "
"encryption, the original plaintext files will "
"be shredded after encryption. In case of decryption, "
"the encrypted files will be shredded after decryption. "
"Abort if you are uncertain or don't understand.", logging.WARNING,
"Dangerous arguments", settings, logger, None)
if settings.PArg is not None:
trezor.prefillPassphrase(settings.PArg)

processing.processAll(trezor, settings, fileMap, logger, feedback)
processing.processAll(trezor, settings, fileMap, logger, dialog=None)
sys.exit(0)
5 changes: 4 additions & 1 deletion basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
TSFEFILEFORMATVERSION = 1

# Name of software version, must be less than 16 long
TSFEVERSION = "v0.3.2"
TSFEVERSION = "v0.4"

# Date of software version, only used in GUI
TSFEVERSIONTEXT = "May 2017"

# default log level
LOGGINGLEVEL = logging.INFO # CRITICAL, ERROR, WARNING, INFO, DEBUG
Loading