我可以為現有的 GPG 金鑰新增到期日期嗎?

我可以為現有的 GPG 金鑰新增到期日期嗎?

我有一個 GPG 金鑰。該密鑰無限有效。我最近想,這不是最好的主意。這就是我的問題的原因:我可以為現有的 GPG 金鑰添加過期日期嗎?還是我唯一的選擇,建立一個新密鑰?

答案1

是的,您可以編輯它。該過程取決於您使用的軟體。我在 Windows 上使用 GPGkeys,您只需右鍵單擊您的私鑰,然後選擇edit > expiration date。您的軟體中可能有類似的方法。您也可以隨時手動撤銷金鑰。

答案2

如果您從命令列執行此操作,則可以使用以下命令來執行此操作gpg:-

[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 protected]>"
4096-bit RSA key, ID A762A666, created 2009-05-08

輸入您的密碼,儲存密鑰,然後就完成了。您可能還想將密鑰重新上傳到您之前上傳過密鑰的任何密鑰伺服器。

相關內容