rnpgp / rnp

RNP: high performance C++ OpenPGP library used by Mozilla Thunderbird
https://www.rnpgp.org
Other
194 stars 55 forks source link

RNP CLI: Show some error message if encryption failed due to expired recipient's key. #1500

Closed ni4 closed 3 years ago

ni4 commented 3 years ago

Description

RNP CLI doesn't show any error message if encryption failed because of expired recipient's key.

Steps to Reproduce

rnp -r "expired_key" somefile.dat

Expected Behavior

Some message is shown, like Encryption failed: recipient's key "expired_key" is expired.

Actual Behavior

No message at all (however, return code is correct and non-zero).

antonsviridenko commented 3 years ago

If passed recipient is a primary key, rnp tries to use it, if it is not suitable, it scans subkeys until some suitable key is found. Looks like if we need to give exact reason why encryption failed, we need to print why each subkey was rejected, otherwise there will be generic error "no suitable key found". That means even if operation is successfull, but there were some expired subkeys, there will be excess warnings printed each time for each expired subkey. Or we need to save rejection reasons and print them only if no key was found.

ni4 commented 3 years ago

@antonsviridenko For now it would be enough to just print some message in cli_rnp_encrypt_and_sign() on failure. Later, once #1457 is implemented, we may improve it by showing a message during recipient addition.

antonsviridenko commented 3 years ago

closed by https://github.com/rnpgp/rnp/pull/1520