expiration date for the keys pgp (automatism)

Steffen Nurpmeso steffen at sdaoden.eu
Sun Jun 11 00:30:01 CEST 2023


P.S.:

Steffen Nurpmeso wrote in
 <20230609132434.xS7mR%steffen at sdaoden.eu>:
 |Werner Koch wrote in
 | <875y7wvn4y.fsf at wheatstone.g10code.de>:
 ||On Mon,  5 Jun 2023 14:49, broussard marc said:
 ||
 ||> => does pgp can tell when the key is becoming soon expired?
 ||
 ||That is easy on Unix:
 ||
 ||  $ gpg --list-keys --with-colons \
 ||| awk -F: -v days=60 \
 ||      'BEGIN { from=systime(); to=from+(days*86400)};\
 |
 |Not _that_ easy ("date +%s" maybe, strftime(3) %s is old).
 |
 |  #?2|kent:$ awk 'END{print systime()}' </dev/null
 |  1686316851
 |  #?0|kent:$ mawk 'END{print systime()}' </dev/null
 |  1686316853
 |  #?0|kent:$ nawk 'END{print systime()}' </dev/null
 |  nawk: calling undefined function systime
 |   source line number 1

Todd Millert of sudo/OpenBSD mentioned that nawk (Kernighan's one
true awk) got systime(), but it is on the [bsd-features] branch of
the github repo[1] only, taken over among other things by Aharon
Robbins of gawk (i had opened an issue; 'and switched my CRUX
Linux port to that branch).

  [1] https://github.com/onetrueawk/awk.git

 |  #?2|kent:$ busybox.static awk 'END{print systime()}' </dev/null
 |  1686316860
 |
 ||       $1=="pub" && $7 > from && $7 < to { found=1 };
 ||       $1=="fpr" && found {found=0; \
 ||          print "key " $10 " expires in the next " days " days"}'
 ||
 ||A really proper solution would use a function to decode field 7 because
 ||it may in the future be shown as YYYYMMDDTHHMMSS (actually gpgsm does it
 ||this way).
 ||
 ||I will consider to allow the expiration date for the --list-filter which
 ||could then be used on Windows (i.e. w/o awk) as well.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
|~~
|..and in spring, hear David Leonard sing..
|
|The black bear,          The black bear,
|blithely holds his own   holds himself at leisure
|beating it, up and down  tossing over his ups and downs with pleasure
|~~
|Farewell, dear collar bear



More information about the Gnupg-users mailing list