GPG Key 생성

Jmnote (토론 | 기여)님의 2014년 4월 21일 (월) 12:00 판 (→‎개요)

1 개요

generate gpg key
GPG KEY 생성
GPG 공개키 개인키 생성
  • 아래 스크립트 대신 gpg --gen-key를 사용하면 대화식으로 진행할 수 있다.

2 명령어

rngd -r /dev/urandom
gpg-agent --use-standard-socket --daemon
cat <<EOF | gpg --batch --no-tty --gen-key
%echo Generating a standard key
Key-Type: default
Key-Length: 2048
Subkey-Type: default
Subkey-Length: 2048
Name-Real: example
Name-Email: example@example.com
Expire-Date: 0
Passphrase: secret
%commit
%echo done
EOF
gpg --export -a 'example' > /vagrant/modules/usemyrepo/files/MY-RPM-GPG-KEY.pub
gpg --export-secret-keys -a 'example' > /vagrant/modules/rpmbuild/files/MY-RPM-GPG-KEY.secret

3 실행예시

[root@jmnote ~]# rngd -r /dev/urandom
[root@jmnote ~]# gpg-agent --use-standard-socket --daemon
gpg-agent[2534]: directory `/root/.gnupg/private-keys-v1.d' created
gpg-agent[2535]: gpg-agent (GnuPG) 2.0.14 started
GPG_AGENT_INFO=/root/.gnupg/S.gpg-agent:2535:1; export GPG_AGENT_INFO;
[root@jmnote ~]# cat <<EOF | gpg --batch --no-tty --gen-key
> %echo Generating a standard key
> Key-Type: default
> Key-Length: 2048
> Subkey-Type: default
> Subkey-Length: 2048
> Name-Real: example
> Name-Email: example@example.com
> Expire-Date: 0
> Passphrase: secret
> %commit
> %echo done
> EOF
gpg: Generating a standard key
gpg: key 3110D314 marked as ultimately trusted
gpg: done
[root@jmnote ~]# gpg --export -a 'example' > MY-RPM-GPG-KEY.pub
[root@jmnote ~]# gpg --export-secret-keys -a 'example' > MY-RPM-GPG-KEY.secret
[root@jmnote ~]# pkill gpg-agent
gpg-agent[2535]: SIGTERM received - shutting down ...
gpg-agent[2535]: gpg-agent (GnuPG) 2.0.14 stopped

4 확인

[root@jmnote ~]# cat MY-RPM-GPG-KEY.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)

mQENBFNUhEoBCAC1v7pwnpWfikT3r+SgPAgtOlj5MfcnW0EHGrX/YbxQY4xLYX9/
KXbrTEW0RDsssfs9aCH0yJXxDtNfLfuwCUk9D1scElG45UMF0hPy0vrNY4Fs+rxp
...(생략)
7unk3w9WaHrEN+ztugMUvQaxn1iR7ug/OeukuXqbfEUvdYnoC3S2BZjRXoZOBSdW
fMkjgc0B5i0S6G+fymnwtOtEGWJ/CygoLHIk1w==
=wPaT
-----END PGP PUBLIC KEY BLOCK-----
[root@jmnote ~]# cat MY-RPM-GPG-KEY.secret 
-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: GnuPG v2.0.14 (GNU/Linux)

lQO+BFNUhEoBCAC1v7pwnpWfikT3r+SgPAgtOlj5MfcnW0EHGrX/YbxQY4xLYX9/
KXbrTEW0RDsssfs9aCH0yJXxDtNfLfuwCUk9D1scElG45UMF0hPy0vrNY4Fs+rxp
... (생략)
FL0GsZ9Yke7oPznrpLl6m3xFL3WJ6At0tgWY0V6GTgUnVnzJI4HNAeYtEuhvn8pp
8LTrRBlifwsoKCxyJNc=
=C7xF
-----END PGP PRIVATE KEY BLOCK-----

5 같이 보기

6 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}