Fresh generated keys won't decrypt
ariek48 opened this issue · 1 comments
Environment
- OS: Mac OS - High Sierry
- rage version: 0.81
What were you trying to do
Encrypting and decrypting files
What happened
Created a 5Mb test file and a test.key
used the -R flag while encrypting.. Error
Removed line 3 with the Secret Key and saved new file as test_public.key
encrypting with test_public.key went okay
Decrypting with -d and -i with original keyfile
Error no matching keys found.
I am doing something wrong but atm i out of ideas.
With keys created a couple of weeks ago. Not a problem
ragetestenv ronald$ mkfile -n 5m temp_5mb_file
ragetestenv ronald$ rage-keygen > test.key
Public key: age1m66v2lgzcwzcqhkjjzepgnsx8qmwx70lkht95jgnkr3llwx3dvgsa9lnjv
ragetestenv ronald$ rage -e -R test.key temp_5mb_file -o temp_5mb_file.age
Error: recipients file test.key contains non-recipient data on line 3
[ Did rage not do what you expected? Could an error be more useful? ]
[ Tell us: https://str4d.xyz/rage/report ]
ragetestenv ronald$ awk 'NR%3!=0' test.key > test_public.key
ragetestenv ronald$ ls
.rw------- 5.2M ronald staff 23 Jun 22:09 temp_5mb_file
.rw-r--r-- 189 ronald staff 23 Jun 22:09 test.key
.rw-r--r-- 114 ronald staff 23 Jun 22:10 test_public.key
ragetestenv ronald$ rage -e -R test_public.key temp_5mb_file -o temp_5mb_file.age
ragetestenv ronald$ ls
.rw------- 5.2M ronald staff 23 Jun 22:09 temp_5mb_file
.rw-r--r-- 5.2M ronald staff 23 Jun 22:10 temp_5mb_file.age
.rw-r--r-- 189 ronald staff 23 Jun 22:09 test.key
.rw-r--r-- 114 ronald staff 23 Jun 22:10 test_public.key
ragetestenv ronald$ rage -d -i test.key temp_5mb_file.age -o temp_5mb_file.org
Error: No matching keys found
[ Did rage not do what you expected? Could an error be more useful? ]
[ Tell us: https://str4d.xyz/rage/report ]
This line
rage -e -R test_public.key temp_5mb_file -o temp_5mb_file.age
is encrypting to nothing, because test_public.key is now like
# created: 2022-06-23T22:48:35+02:00
# public key: age1d8jxqr7g92d586a4ncrrmspwxdv7n0wmr7k3y449dnpvnjwwp9ks7ukvsm
which is just two comment lines.
A file to pass to -R
would instead look like
age1d8jxqr7g92d586a4ncrrmspwxdv7n0wmr7k3y449dnpvnjwwp9ks7ukvsm
To help the user, rage should refuse to encrypt to no recipients.