GPG 备份私钥和公钥导出到文件 | GPG Backup

标签: none

  1. 创建 EdDSA 密钥 Ed25519
  2. 备份 GPG 密钥
  3. 导出公钥
  4. 导出私钥

创建 EdDSA 密钥 Ed25519

$ gpg --expert --full-gen-key
gpg (GnuPG) 2.1.0; Copyright (C) 2014 Free Software Foundation, Inc.
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)
   (7) DSA (set your own capabilities)
   (8) RSA (set your own capabilities)
   (9) ECC and ECC
  (10) ECC (sign only)
  (11) ECC (set your own capabilities)
Your selection? 10
Please select which elliptic curve you want:
   (1) Curve 25519
   (2) NIST P-256
   (3) NIST P-384
   (4) NIST P-521
   (5) Brainpool P-256
   (6) Brainpool P-384
   (7) Brainpool P-512
Your selection? 1
gpg: WARNING: Curve25519 is not yet part of the OpenPGP standard.
Use this curve anyway? (y/N) y
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)
Key does not expire at all
Is this correct? (y/N) y

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

Real name: Laura Poitras
Email address: laura@example.org
Comment:
You selected this USER-ID:
    "Laura Poitras "

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
[...]
pub   ed25519/5C1AFC2A 2014-11-03
      Key fingerprint = ED85 4D98 5D8F 502F C6C5  FFB2 AA81 319E 5C1A FC2A
uid       [ultimate] Laura Poitras 

列出您拥有的密钥

gpg --list-secret-keys --keyid-format=long
/Users/hubot/.gnupg/secring.gpg
------------------------------------
sec   4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10]
uid                          Hubot 
ssb   4096R/42B317FD4BA89E7A 2016-03-10

导出公钥

# 直接打印出来
gpg --armor --export 3AA5C34371567BD2
# 保存倒文件
gpg --armor --export 3AA5C34371567BD2 --output public.pgp

导出私钥

# 直接打印出来
gpg --armor --export-secret-key 3AA5C34371567BD2
# 保存倒文件
gpg --armor --export-secret-key 3AA5C34371567BD2 --output private.pgp

导出密钥, 将其复制到另一台机器上

gpg --export-secret-key name > ~/my-key.asc

导入密钥

gpg --import my-key.asc

参考
如何将GPG私钥和公钥导出到文件
Generating a new GPG key
How can I use GnuPG with ECDSA keys?
What’s new in GnuPG 2.1


扫描二维码,在手机上阅读!

添加新评论