rnp icon indicating copy to clipboard operation
rnp copied to clipboard

Add CLI command to update key/subkey expiration time.

Open ni4 opened this issue 4 years ago • 1 comments

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).

ni4 avatar May 12 '20 11:05 ni4

Currently, as we have --edit-key command, expiration setting may be implemented as subcommand.

ni4 avatar Apr 28 '22 09:04 ni4

@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 avatar Jan 27 '23 19:01 antonsviridenko

@antonsviridenko Yeah, I think it would be good to print out key's info after it is updated.

ni4 avatar Jan 27 '23 20:01 ni4

@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 avatar Jan 28 '23 17:01 antonsviridenko

@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 avatar Jan 28 '23 18:01 ni4

@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?

antonsviridenko avatar Jan 29 '23 22:01 antonsviridenko

nvm, found already

antonsviridenko avatar Jan 29 '23 22:01 antonsviridenko