gpg: -:9: invalid expire date--GPG Keychain for Mac

Peter C. Pugh's Avatar

Peter C. Pugh

18 May, 2021 03:39 PM

Invalid expire date--GPG Keychain for Mac

Lost my GPG private key, and can't create new GPG Keychain key due to "gpg: -:9: invalid expire date"

I lost my GPG private key. I had actually forgotten I even had one until a few days ago when I started getting encrypted notifications emails from Facebook. After investigating I found I had a PGP Public key attached to my FB account. Looking back through my passwords, etc., I found a GPG Keychain Password but no GPG Keychain Private Key. I also found I had a GPG/PGP public key stored on the GPG Keychain Servers.

I looked through GPGTools Support for the process of handling a lost Private Key. I found I need to revoke the key using the revocation certificate stored in "~/.gnupg/RevCerts" and then create a new key.

Next Steps:
I realise I can't recover the private key and hence I can't access any emails previously encrypted with it. That's as it is and can't be changed.

I also can't revoke the old key as the machine that GPGKeychain was originally installed on was wiped and sold on six month plus ago, so I don't have the revocation certificate.

So I moved on to try and create a new keyed that's where I'm getting the failure. I get a pop that reads:

Oops, something went wrong. There was a problem creating your key.
Generate new key failed!
Code = 0
Error text:
gpg: -:9: invalid expire date

So having said all that, how do I create a new key now?

Thank you.

  1. Support Staff 1 Posted by Steve on 18 May, 2021 05:05 PM

    Steve's Avatar

    Hi Peter,

    welcome to the GPGTools support platform. Sorry to hear you are having problems using GPG Suite.

    Do you still have a backup of your old mac? If yes you should be able to maybe retrieve your secret key and or the revocation certificate.

    The error you are seeing is curious. Which version of macOS are you running?

    Could you please download and install our latest hotfix GPG Suite and see if that solves your problem.

    All the best,

    Disclaimer: Hotfixes are GPG Suite builds containing our latest source code, so bugs and crashes may occur.

  2. 2 Posted by Peter Pugh on 18 May, 2021 05:42 PM

    Peter Pugh's Avatar

    Hello Steve,

    Thank you for responding so quickly. The answer re. backups is unfortunately no. I tend not to do system backups, just my data as I rely on Apple iCloud to keep copies of Keychain, etc. I realise that I have lost my old encryption and any emails that have ever been encrypted with it, which is annoying but not too painful. Basically, I had forgotten that I had even used GPGKeychain in the past.

    My concern here isn’t about access to my old private key, it’s about creating a new key and this expiry date error.

    As regards my machine, specs are:

    Hardware Overview:

      Model Name: Mac mini
      Model Identifier: Macmini9,1
      Chip: Apple M1

    System Software Overview:

      System Version: macOS 11.3.1 (20E241)
      Kernel Version: Darwin 20.4.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal



  3. Support Staff 3 Posted by Steve on 18 May, 2021 05:45 PM

    Steve's Avatar

    Had you installed the nightly build and checked if that allows for creation of a new key?

    Backups are actually cheap - harddrives and even ssds are very affordable and macOS comes with Time Machine or if you want a bootable backup you can use CarbonCopyCloner or SuperDuper.

  4. 4 Posted by Peter C. Pugh on 18 May, 2021 05:50 PM

    Peter C. Pugh's Avatar

    Re. backups, thank you. It's my way of doing things here that's the issue. I actually have plenty of backup space; just, it now seems, not an appropriate backup procedure. Isn't it always the way that you find out the gaps in a process when you fall down one of the resultant holes!!

    As regards the version of GPGKeychain. I just downloaded and installed the latest released "production" build from the GPGTools website this afternoon. I haven't looked for any pre-release versions.

  5. 5 Posted by Peter C. Pugh on 18 May, 2021 05:57 PM

    Peter C. Pugh's Avatar

    I've just been trying to find the nightly or beta downloads but can't. I just get the released build. Can you send me a link to either please?

  6. Support Staff 6 Posted by Steve on 18 May, 2021 05:58 PM

    Steve's Avatar

    Link was in my first reply:
    Could you please download and install our latest hotfix GPG Suite and see if that solves your problem.

  7. 7 Posted by Peter C. Pugh on 18 May, 2021 06:03 PM

    Peter C. Pugh's Avatar

    Apologies is this is a stupid question. Do I install over the top of the existing installation or do I need to uninstall the existing and clean install the hotfix?

  8. Support Staff 8 Posted by Steve on 18 May, 2021 06:04 PM

    Steve's Avatar

    No need to uninstall. You can run the installer over the existing installation.

  9. 9 Posted by Peter C. Pugh on 18 May, 2021 06:08 PM

    Peter C. Pugh's Avatar

    Same error.

    BTW ... I have also tried with different dates, including the expiry date of my lost key.

  10. Support Staff 10 Posted by Steve on 18 May, 2021 06:18 PM

    Steve's Avatar

    Can you send a screenshot of your system time from system preferences.

  11. 11 Posted by Peter C. Pugh on 18 May, 2021 06:28 PM

    Peter C. Pugh's Avatar
  12. 12 Posted by Jose on 19 May, 2021 02:18 AM

    Jose's Avatar

    Just solved this same problem by going into System Preferences > Date & Time > Open Language & Region and setting my region to the United States.

    My guess is the problem had to do with my country writing dates as dd/mm/yyyy whereas the US uses mm/dd/yyyy

  13. 13 Posted by Peter C. Pugh on 19 May, 2021 08:37 AM

    Peter C. Pugh's Avatar

    Thank you Jose that also fixed it for me.

    Suggest that expecting the expiry date to be in US format and for international customers to switch their location to being United States is a bug.

  14. Support Staff 14 Posted by Steve on 25 May, 2021 10:42 AM

    Steve's Avatar

    Thanks Jose for chiming in here and providing important info to debug this.

    Using german on a test system here which uses dates as and had no trouble creating new keys.

    Then switched region to America > Barbados using dd/mm/yyyy and was also able to create a key.

    Could you both provide a screenshot of System Preferences > Language & Region with the problematic settings which resulted in GPG Keychain being unable to create new keys.

    Thank you,

  15. 15 Posted by Peter Pugh on 25 May, 2021 10:58 AM

    Peter Pugh's Avatar

    As requested …

    Kind regards

  16. Support Staff 16 Posted by Steve on 25 May, 2021 11:12 AM

    Steve's Avatar

    I am still unable to reproduce. Using macOS 11.4 and GPG Suite 2021.1 for my test.

    Have you already updated to macOS 11.4 and 2021.1 and the issue is still persisting for you?

  17. 17 Posted by Peter Pugh on 25 May, 2021 12:15 PM

    Peter Pugh's Avatar

    Current versions …

    I haven't tried to reproduce the issue since applying Jose's fix as it also worked for me and I was able to create my key.

    Kind regards,


  18. 18 Posted by Peter Pugh on 25 May, 2021 12:16 PM

    Peter Pugh's Avatar

    BTW … In case I didn’t mention in any other update, I’m using a MacMini M1.

  19. Support Staff 19 Posted by Steve on 25 May, 2021 12:17 PM

    Steve's Avatar

    You are running macOS 11.3.1 so 11.4 should be available.

    And you are runnning GPG Suite nightly for which 2021.1 stable should be available.

    Could you update both and then see if you are still able to reproduce the key creation problem? You can create a key with any email and not upload it to the key servers just for testing.

  20. Support Staff 20 Posted by Steve on 31 May, 2021 07:27 PM

    Steve's Avatar

    Closing, since no further user feedback was received. Should your problem persist, feel free to re-open this discussion any time.

    All the best,

  21. Steve closed this discussion on 31 May, 2021 07:27 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac