GPG Key를 생성해보자!

1. 우선 GPG command line tools 를 다운받는다. 링크 클릭!
Github에서는 최신 버전을 다운받는 것을 권장한다. 
맥은 dmg 파일을 통해 설치한다. 

dmg 설치

2. 이제 Terminal을 키고 key를 생성해 준다. 
2.1.17 이후 버전이라면 아래 커맨드를 통해 키를 생성할 수 있다. 

gpg --full-generate-key

3. 키를 생성할 때 설정이 필요하다. 
- key 종류
- key size
- 이름, 이메일, 코멘트

  ~  gpg --full-generate-key
gpg (GnuPG/MacGPG2) 2.2.34; Copyright (C) 2022 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
  (14) Existing key from card
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (3072)
Requested keysize is 3072 bits
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) 1y
Key expires at 일 10/22 14:00:25 2023 KST
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: ye-geeee
Email address: yeaji9683@gmail.com
Comment:
You selected this USER-ID:
    "ye-geeee <yeaji9683@gmail.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: directory '/Users/gang-yeji/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/Users/***/.gnupg/openpgp-revocs.d/***.rev'
public and secret key created and signed.

pub   rsa3072 2022-10-22 [SC] [expires: 2023-10-22]
      ***
uid                      ye-geeee <yeaji9683@gmail.com>
sub   rsa3072 2022-10-22 [E] [expires: 2023-10-22]

4. 비밀번호를 설정한다.

그러면 키 생성 끝!

5. 아래 커맨드로 키가 제대로 생성 되었는지 확인하자!
그리고 sec 오른쪽에 있는 GPG Key ID를 확인하고 복사한다. 

gpg --list-secret-keys --keyid-format=long

나오는 결과는 아래와 같다. 

gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2023-10-22
/Users/***/.gnupg/pubring.kbx
-----------------------------------
sec   rsa3072/[GPG Key ID] 2022-10-22 [SC] [expires: 2023-10-22]
      ***
uid                 [ultimate] ye-geeee <yeaji9683@gmail.com>
ssb   rsa3072/*** 2022-10-22 [E] [expires: 2023-10-22]

 

참고 링크

Github GPG key 생성 가이드

 

반응형
복사했습니다!