veracrypt / VeraCrypt

Disk encryption with strong security based on TrueCrypt
https://www.veracrypt.fr
Other
6.71k stars 935 forks source link

[windows] Add a `--stdin` switch, or equivalent for Windows #867

Open brianddk opened 2 years ago

brianddk commented 2 years ago

I noticed the Windows documentation doesn't list --stdin as an option. I realize that some Windows GUI frameworks makes reading from stdin on a GUI app launch difficult. Perhaps this is the case. But there are certainly other windows encryption apps like EncFSMP and KeePass that do allow it. So it certainly isn't impossible.

For Windows, the standard convention would be something like /password - where the tick (-) signifies that the data should be pulled from stdin.

Thoughts on adding if if possible, or documenting it if done?

Desired behavior

Add the ability to use /password - to read from stdin similar to the Linux --stdin switch. If this is already the case, please update the documentation to reflect it.

Your Environment

VeraCrypt version: 1.25.4 x64

Operating system and version: Microsoft Windows [Version 10.0.16299.2166]

System type: 64-bit Intel

idrassi commented 2 years ago

As you have guessed, VeraCrypt executable on Windows is a GUI application that uses WinMain instead of main and as such it doesn't have a console attached to it, which means that there is no stdin to read from or stdout to write to.

I have looked at KeePass and it supports only a specific use cases where stdin exists for GUI application. Typical example is when echo command is used to pipe a string value to a GUI application. For example, in our case it will be:

echo PasswordValue | "C:\Program Files\VeraCrypt\VeraCrypt.exe" /v volume.hc /l z /stdin /q

Is this what you have in mind?

brianddk commented 2 years ago

Is this what you have in mind?

@idrassi , Yes, that is exactly it. I have a script that dumps a secret for piping, so my config would be something like:

python getSecret.py | "C:\Program Files\VeraCrypt\VeraCrypt.exe" /v volume.hc /l z /stdin /q

The script is complex, but suffice to say it is the secret keeper.

aetonsi commented 2 years ago

Please, please, this is absolutely needed, otherwise the password is visible in the command line.

I also have a script to unlock all my Veracrypt volumes and i need to pipe its output to veracrypt.exe in order to unlock my drives.

The only alternative solution i could come up with is copying the password to the clipboard before invoking veracrypt.exe... this is not ideal obviously.

Thank you for your time, have a wonderful day