Skip to content

Instantly share code, notes, and snippets.

@fmnoise
Forked from krisleech/renew-gpgkey.md
Last active May 21, 2022 09:38
Show Gist options
  • Save fmnoise/02e0df3352d80cf5eb191f203706f61d to your computer and use it in GitHub Desktop.
Save fmnoise/02e0df3352d80cf5eb191f203706f61d to your computer and use it in GitHub Desktop.

Revisions

  1. fmnoise revised this gist May 21, 2022. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions renew-gpgkey.md
    Original file line number Diff line number Diff line change
    @@ -36,13 +36,17 @@ Save your changes made in the GPG key
    gpg> save
    ```

    # Test

    Test it out, do a round trip:

    ```
    gpg -ea > secret.out
    gpg -d secret.out
    ```

    # Export

    Backup the key:

    ```
  2. fmnoise revised this gist May 21, 2022. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion renew-gpgkey.md
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,11 @@ Since the key has changed we now need to trust it, otherwise we get the error "T
    gpg> trust
    ```

    Save your changes made in the GPG key
    ```
    gpg> save
    ```

    Test it out, do a round trip:

    ```
    @@ -58,4 +63,13 @@ If you need to copy/paste the public key to a key server:

    ```
    xclip -i kris.leech.gpgp.public -selection clipboard
    ```
    ```

    # Github

    Get the content of the public key using the following command. Copy this public key.
    ```
    gpg -a --export KEYID
    ```
    Now, go to GitHub and delete your existing GPG key that has expired. And then click on the New GPG key button and paste the public key we have copied in step 2. Save this public key.
    In this way, you have successfully updated an expired GPG key and all of the commits that are signed with the expired key are now marked from unverified to verified.
  3. @krisleech krisleech revised this gist Sep 28, 2018. 1 changed file with 8 additions and 6 deletions.
    14 changes: 8 additions & 6 deletions renew-gpgkey.md
    Original file line number Diff line number Diff line change
    @@ -7,12 +7,14 @@ $ gpg --list-keys
    $ gpg --edit-key KEYID
    ```

    Use the expire command to set a new expire date in the far future, e.g. `1y`.
    Use the expire command to set a new expire date:

    ```
    gpg> expire
    ```

    When prompted type `1y` or however long you want the key to last for.

    Select all the subkeys (the primary key, which we just set the expires date for, is key 0):

    ```
    @@ -23,13 +25,13 @@ gpg> expire

    A star will sppear before all selected keys.

    Since the key has changed we now need to trust it, otherwise we get the error ""There is no assurance this key belongs to the named user":
    Since the key has changed we now need to trust it, otherwise we get the error "There is no assurance this key belongs to the named user" when using they key:

    ```
    gpg> trust
    ```

    Test it out, create an encrypted message.
    Test it out, do a round trip:

    ```
    gpg -ea > secret.out
    @@ -45,15 +47,15 @@ gpg -a --export-secret-keys KEYID > kris.leech.gpg.private

    Move the keys on to something like a USB drive and store it safely in another location.

    Publish the key:
    Publish the public key:

    ```
    gpg --keyserver keyserver.ubuntu.com --send-keys KEYID
    gpg --keyserver pgp.mit.edu --send-keys KEYID
    ```

    If you need to copy/paste the key to a public server:
    If you need to copy/paste the public key to a key server:

    ```
    xclip -i kris.leech.gpgp.public -selection clipboard
    ```
    ```
  4. @krisleech krisleech revised this gist Sep 28, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions renew-gpgkey.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,8 @@ gpg -a --export KEYID > kris.leech.gpg.public
    gpg -a --export-secret-keys KEYID > kris.leech.gpg.private
    ```

    Move the keys on to something like a USB drive and store it safely in another location.

    Publish the key:

    ```
  5. @krisleech krisleech revised this gist Sep 28, 2018. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions renew-gpgkey.md
    Original file line number Diff line number Diff line change
    @@ -21,6 +21,8 @@ gpg> key 2
    gpg> expire
    ```

    A star will sppear before all selected keys.

    Since the key has changed we now need to trust it, otherwise we get the error ""There is no assurance this key belongs to the named user":

    ```
    @@ -36,6 +38,10 @@ gpg -d secret.out

    Backup the key:

    ```
    gpg -a --export KEYID > kris.leech.gpg.public
    gpg -a --export-secret-keys KEYID > kris.leech.gpg.private
    ```

    Publish the key:

    @@ -47,6 +53,5 @@ gpg --keyserver pgp.mit.edu --send-keys KEYID
    If you need to copy/paste the key to a public server:

    ```
    gpg --armor --export KEYID > kris.leech.gpg.pub
    xclip -i kris.leech.gpgp.pub -selection clipboard
    xclip -i kris.leech.gpgp.public -selection clipboard
    ```
  6. @krisleech krisleech created this gist Sep 28, 2018.
    52 changes: 52 additions & 0 deletions renew-gpgkey.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    # Renew GPG key

    Given that your key has expired.

    ```
    $ gpg --list-keys
    $ gpg --edit-key KEYID
    ```

    Use the expire command to set a new expire date in the far future, e.g. `1y`.

    ```
    gpg> expire
    ```

    Select all the subkeys (the primary key, which we just set the expires date for, is key 0):

    ```
    gpg> key 1
    gpg> key 2
    gpg> expire
    ```

    Since the key has changed we now need to trust it, otherwise we get the error ""There is no assurance this key belongs to the named user":

    ```
    gpg> trust
    ```

    Test it out, create an encrypted message.

    ```
    gpg -ea > secret.out
    gpg -d secret.out
    ```

    Backup the key:


    Publish the key:

    ```
    gpg --keyserver keyserver.ubuntu.com --send-keys KEYID
    gpg --keyserver pgp.mit.edu --send-keys KEYID
    ```

    If you need to copy/paste the key to a public server:

    ```
    gpg --armor --export KEYID > kris.leech.gpg.pub
    xclip -i kris.leech.gpgp.pub -selection clipboard
    ```