如何在 GnuPG 中使用长密码?

如何在 GnuPG 中使用长密码?

我正在使用 Arch Linux 和 GnuPG

Linux ryantm0j132 3.12.9-2-ARCH #1 SMP PREEMPT Fri Jan 31 10:22:54 CET 2014 x86_64 GNU/Linux

和 GnuPG

gpg (GnuPG) 2.0.22
libgcrypt 1.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECC, ?
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

使用gpg --gen-key,它会弹出一个 GUI 对话框,要求输入密码。如何将一长串字符粘贴到密码文本框中?我可以输入一长串字符,但以后我必须反复这样做。

答案1

一个解决方法可能是切换到pinentry-curses而不是 GUI pinentry,它提供“普通”命令行 pinentry(您应该能够将密码粘贴到其中)。似乎它默认安装在 Arch Linux 上(包的依赖性gnupg)。

为此,请将pinentry-program中的选项修改~/.gnupg/gpg-agent.confpinentry-curses。在Arch Linux 维基对于 Ubuntu Linux,我也在 Ask Ubuntu 上解释了如何做到这一点(在另一个上下文中)

或者,你也可以使用另一个提供密码的非交互式选项。从man gpg(这些都是的参数gpg,您也应该能够将它们放入gpg.conf):

   --passphrase-fd n
          Read  the passphrase from file descriptor n. Only the first line
          will be read from file descriptor n. If you use  0  for  n,  the
          passphrase  will  be  read  from STDIN. This can only be used if
          only one passphrase is supplied.

   --passphrase-file file
          Read the passphrase from file file. Only the first line will  be
          read  from  file  file.  This  can  only  be  used  if  only one
          passphrase is supplied. Obviously, a passphrase stored in a file
          is  of  questionable security if other users can read this file.
          Don't use this option if you can avoid it.

   --passphrase string
          Use string as the passphrase. This can only be used if only  one
          passphrase  is supplied. Obviously, this is of very questionable
          security on a multi-user system. Don't use this  option  if  you
          can avoid it.

相关内容