I want to check if key in a gpg file is expired without importing so I tried this :

$ gpg --list-options show-sig-expire my_key.gpg
pub  2048R/8719FCE4 2016-09-28 home:stevenpusser OBS Project <home:stevenpusser@build.opensuse.org>

but it does not show want I need.

I've found this command but it does not exactly check if the gpg file is expired, it only shows the expiration date :

$ gpg --with-colons my_key.gpg 
pub:e:2048:1:0FAD31CA8719FCE4:2016-09-28:2018-12-07::-:home\x3astevenpusser OBS Project <home\x3astevenpusser@build.opensuse.org>:

I want to be able to automate the check of the expiration of the gpg key file.

Can you help?

migrated from security.stackexchange.com Apr 1 at 11:01

This question came from our site for information security professionals.

  • If you want to automate checking for expired files, then script a check for the expiration date and compare to the current date. – schroeder Apr 1 at 10:37
  • @schroeder Instead of scripting, isn't there another gpg command that does the job such as returning expired and/or some non 0 exit code ? – SebMa Apr 1 at 10:40
  • 1
    There is no reason for that function to exist. It makes far more sense to return the expiration date and let the functions that need to perform a check to do the compare to the current date. If there was such a command, you could comb through the man pages to locate it. Either way, this is not a security question but a scripting question or a documentation lookup question. – schroeder Apr 1 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.