rnp
rnp copied to clipboard
Add CLI command to update key/subkey expiration time.
Description
Possible command is:
rnpkeys --set-expiry <userid/keyid/fingerprint> expiry
.
Where expiry could be in a GnuPG-like format: 1000 (seconds), 1000h (hours), 1000d (days), 20m (monthes), 3y (years).
Currently, as we have --edit-key
command, expiration setting may be implemented as subcommand.
@ni4 do we need to print out updated key info after the expiration time is updated? Using cli_rnp_print_key_info()
like it is done for new key generation/new subkey?
@antonsviridenko Yeah, I think it would be good to print out key's info after it is updated.
@ni4 I think I've found a bug probably somewhere in rnp_cfg::get_expiration()/rnp_cfg::parse_date()
or other datetime related calculations:
rnpkeys --edit-key --set-expire 2023-11-02 74ee2823e9d6fd26
Enter password for key 0x5174F3BB8CE3A9F6 to unlock:
Enter password for key 0x74EE2823E9D6FD26 to unlock:
ssb 2048/DSA 74ee2823e9d6fd26 2023-01-28 [S] [EXPIRES 2023-11-01]
8eea11ac701bdab57cb2c9e974ee2823e9d6fd26
Expiration date is set to 2023-11-02 but resulting expiration date is 2023-11-01
@antonsviridenko It should be related to UTC/localtime conversions (inside of library all is in UTC while CLI is in localtime), will investigate the possible causes in the PR review/afterwards.
@ni4 do we have any existing code in cli_tests.py
that captures fingerprint of the newly generated key or subkey from the CLI output?
nvm, found already