如何导出私钥?(GnuPG)

ran*_*cho 5 terminal rsa gpg private-key public-key

我已经使用 RSA 和 RSA 算法成功创建了 GnuPG 公钥/私钥对。如何以带有.asc扩展名的文件形式导出公钥和私钥?

dav*_*085 12

提示 1:gpg将私钥称为“秘密”,因为 PGP 可以追溯到人们确定(理想情况下)只有一方持有的非对称对的一半的名称“私钥”与通常持有的对称值的“秘密”密钥之前由两个或更多相互信任的方而不是其他人。

man gpg2 | less "+/export-secret"然后n(转到第二场比赛)显示:

   --export-secret-keys

   --export-secret-subkeys
          Same  as --export, but exports the secret keys instead.  This is
          normally not very useful and a security risk.  The  second  form
          of  the  command  has  the special property to render the secret
          part of the primary key useless; this  is  a  GNU  extension  to
          OpenPGP  and  other  implementations can not be expected to suc-
          cessfully import such a key.  See the option  --simple-sk-check-
          sum  if  you  want  to import such an exported key with an older
          OpenPGP implementation.
Run Code Online (Sandbox Code Playgroud)

提示 2:您可以通过重定向或使用(之一)来输出到文件

   --output file

   -o file
          Write output to file.
Run Code Online (Sandbox Code Playgroud)

然而,人们通常使用.asc'ASCII Armor(ed)' 格式的文件扩展名,它是 base64,带有破折号-BEGIN 和破折号-END 行,有时(包括此处)822/MIME 样式的标头。如果您不仅想要一个名为 的文件.asc,还想要一个通常.asc格式的文件,请使用(之一)

   --armor

   -a     Create ASCII armored output.   The  default  is  to  create  the
          binary OpenPGP format.
Run Code Online (Sandbox Code Playgroud)

域名注册地址:

gpg2 --export-secret-keys -a -o file.asc [keyid ...]
Run Code Online (Sandbox Code Playgroud)