Tuesday 16 July 2019

How to renewal GPG keys

Step1 : list the gpg keys

[root@sankar]# gpg --list-keys
/root/.gnupg/pubring.gpg
------------------------
pub   1024D/1F8EKKRW 2016-04-16
uid                  dev-BACKUP (For dev Servers backup) <sankar@xxxx.com>
sub   2048g/78B5KER5 2016-04-16


Step2: take backup of keys

Pub key:-
[root@sankar]#gpg --output sankar_Profile_Encryption2019.gpg --armor --export 1F8EKKRW


Secret key/Private Key:-
[root@sankar]#gpg --output sankar_Profile_Encryption2019_sec.gpg --armor --export-secret-key 1F8EKKRW


Step3: Edit the key
[sai@sankar]$ gpg --edit-key 1F8EKKRW
gpg (GnuPG) 1.4.5; Copyright (C) 2006 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.


gpg> expire

Changing expiration time for the primary key.

Please specify how long the key should be valid.

         0 = key does not expire

        = key expires in n days

      w = key expires in n weeks

      m = key expires in n months

      y = key expires in n years

Key is valid for? (0)            ///enter for my case

Is this correct? (y/N) y



gpg>save




Note: if you need to specific years, you need to specify like 2year/3years