rage
rage copied to clipboard
UX: Rage does not encrypt data piped in from stdin when using -p/--passphrase
What were you trying to do
Encrypt data piped in from stdin using a passphrase.
What happened
It refused to encrypt data piped in from stdin using a passphrase. This works just fine with age, but not rage. rage will also decrypt data piped in from stdin just fine, but not encrypt.
$ echo "Attack at dawn!" | rage --armor --passphrase
Error: File to encrypt must be passed as an argument when using -p/--passphrase
[ Did rage not do what you expected? Could an error be more useful? ]
[ Tell us: https://str4d.xyz/rage/report ]
This same thing works with age, and rage has no problem decrypting data from stdin.
$ echo "Attack at dawn!" | age --armor --passphrase | rage -d
Attack at dawn!
Upon further investigation, it appears that rage requires you to specify - as the filename if you want to encrypt data piped in from stdin with a passphrase, like this:
$ rage-keygen | rage --armor --passphrase -
Public key: age16ju2609mvqchrucn5qnsndrtwshveyhfuc4zn5xfvycjazpw0gmsd68gue
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCBrM0I2azU4YlpNaGVVS29n
SThZL2dRIDE5CjlJc1BvcTRBaG04elphbEh0T3FXWXVsUFZRaWdJRGg5d2Zxa0ox
WFpoa2MKLS0tIGJXRWVQaEdpOXRzSUpFK3pIMS9DQnhBVEdkK083NlNYQmhWNlVI
U3M0QjgKqC9MIDQS+XouvauCbNjx6I73D2YljpP2SJUK4QduGx1VUKOqTPLFA4WO
XBVoZ9T5l+t8NEA5IVT+aw2crDHowJGe4oANYsA6+cSWxRfaJhxG902bFSeOyjUa
s88wPNmwYBjnh0dz0MG8O/UCErI+J1Zx1PuShDmo/6UB7G//wck3v9E1XtXmlFl+
d1EVx6g86XSLGi/HAovihwHBNpEL/y7uShw+di67jFfirV3ejmanEkpe4vb4AhvA
DG4vvVnD25k1RTETr8+17W8ifX+4G0Vo+qclNpi53D8Hbpc=
-----END AGE ENCRYPTED FILE-----
This is inconsistent with the go implementation. This is also inconsistent with rage in the case of using public-key encryption. But at least there's a workaround. Is this the desired behavior?