I have a GPG-key. This key is unlimited valid. I thought recently, that this isn't the best idea. That's why my question: Can I add an expiration-date to an existant GPG-key? Or is my only option, to create a new key?
Yes, you can edit it. The process will depend on the software you're using. I use GPGkeys for Windows, where all you have to do is right-click on your private key, and choose
edit > expiration date. There is probably a similar method in your software. You can also manually revoke a key at any time.
If you're doing this from the commandline, you can do it with
[andys@daedalus ~]$ gpg --edit-key 0xA762A666 <...> Command> expire Changing expiration time for the primary key. Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) 10y Key expires at Mon 14 Dec 2020 23:49:53 GMT Is this correct? (y/N) y You need a passphrase to unlock the secret key for user: "Andy Smith <email@example.com>" 4096-bit RSA key, ID A762A666, created 2009-05-08
Enter your passphrase, save the key, and you're done. You may want to reupload the key to any keyservers you've previously uploaded the key to as well.