如何导出私钥? (GnuPG)

我已经使用RSA和RSAalgorithm成功创build了GnuPG公钥/私钥对。 如何以.asc扩展名的文件格式导出公钥和私钥?

提示1:gpg 调用私人密钥的“秘密”,因为PGP的date是在人们对一个非对称对的一半非对称对(由理想情况下)只有一方对“秘密”由两个或两个以上的相互信任的方面,但没有其他人。

man gpg2 | less "+/export-secret" 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. 

提示2:您可以通过redirect或使用(任一)输出到文件,

  --output file -o file Write output to file. 

然而,人们通常使用.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. 

TLDR:

 gpg2 --export-secret-keys -a -o file.asc [keyid ...]