Menu +

Search Posts

How to make RPM-GPG-KEY

1. Start apg-agent

[builduser@jmnote ~]$ rngd -r /dev/urandom
[builduser@jmnote ~]$ gpg-agent --use-standard-socket --daemon
gpg-agent[2502]: directory `/home/builduser/.gnupg' created
gpg-agent[2502]: directory `/home/builduser/.gnupg/private-keys-v1.d' created
GPG_AGENT_INFO=/home/builduser/.gnupg/S.gpg-agent:2503:1; export GPG_AGENT_INFO;
gpg-agent[2503]: gpg-agent (GnuPG) 2.0.14 started

2. Generate Key

[builduser@jmnote ~]$ cat <<EOF | gpg2 --batch --no-tty --gen-key
> %echo Generating a standard key
> Key-Type: default
> Key-Length: 2048
> Subkey-Type: default
> Subkey-Length: 2048
> Name-Real: Hyodae
> Name-Email: Hyodaekim@gamil.com
> Passphrase: Password
> %commit
> %echo done
> EOF
gpg: keyring `/home/builduser/.gnupg/secring.gpg' created
gpg: keyring `/home/builduser/.gnupg/pubring.gpg' created
gpg: Generating a standard key
gpg: /home/builduser/.gnupg/trustdb.gpg: trustdb created
gpg: key 8E933200 marked as ultimately trusted
gpg: done

3. Check the gpg fingerprint

[builduser@jmnote ~]$ gpg --fingerprint
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2024-05-29
/home/builduser/.gnupg/pubring.gpg
----------------------------------
pub   2048R/8E933200 2014-06-01 [expires: 2024-05-29]
      Key fingerprint = 2EF8 4B50 BD83 AFAE 3A75  A2DB FD67 3C78 8E93 3200
uid                  Hyodae <hyodaekim@gmail.com>
sub   2048R/3D2F8AC9 2014-06-01 [expires: 2024-05-29]

4. Extract Key file

builduser@jmnote ~]$ gpg -a -o RPM-GPG-KEY-builduser --export 8E933200
[builduser@jmnote ~]$ cat RPM-GPG-KEY-builduser 
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)

mQENBFOKe3IBCADDu96SH0NyXXFYra0YX+aMjSLrrHU8lNMnaE9vwJlmEX//ZIln
... 
y8VG+9ualBZSmdvl8Brd4gRFG3mu18BSUmzK8VYmJLvmWqz+2GU=
=O5nm
-----END PGP PUBLIC KEY BLOCK-----
builduser@jmnote ~]$ echo '%_gpg_name 8E933200' > ~/.rpmmacros
[builduser@jmnote ~]$ cat ~/.rpmmacros
%_gpg_name 8E933200

Leave a Reply

Your email address will not be published. Required fields are marked *