禁止GPG命令中的密码短语提示 [英] Suppress the passphrase prompt in GPG command

查看:99
本文介绍了禁止GPG命令中的密码短语提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对GPG有疑问,但是我写了所有流程,也许会对别人有帮助.

I have a question about GPG, but I write all of the process, maybe it will help someone.

我要:抑制GPG命令中的密码提示.我不想:使用-c选项(-对称).

我有2个系统Linux和Windows.我想将数据从Linux发送到Windows.我想在Linux中加密数据并在Windows中解密.

I have 2 systems Linux and Windows. I want to send the data from Linux to Windows. I want to encrypt the data in Linux and decrypt in Windows.

  • myFileOnLinux.txt 是Linux上我要加密的文件.
  • my@Email.com 配对密钥的UID.
  • myPasswordPhrase 是密码短语.
  • myFileOnLinux.txt is a file on Linux that I want to encrypt.
  • my@Email.com the UID of pair key.
  • myPasswordPhrase is the password phrase.

我在两者上都安装了GPG并执行了以下步骤:

I installed GPG on both and did the steps:

  1. Windows 中生成一个配对密钥:

gpg --gen-key

  • Windows 中更改关键参数:

    gpg --edit-key my@Email.com
    

    trust
    5
    expire
    0
    

  • 导出公钥:

  • Export the public keys:

    gpg -a --export my@Email.com > public.key
    

  • 将公钥发送到Linux计算机.

  • Send the public key to the Linux machine.

    在Linux中导入公钥.

    Import the public key in Linux.

    gpg --import public.key
    

  • 在Linux中更改trust参数

  • Change the trust parameter in Linux

    gpg --edit-key my@Email.com
    

    trust
    5
    

  • 在Linux中加密文件

  • Encrypt a file in Linux

    gpg --output output.enc --encrypt --recipient my@Email.com myFileOnLinux.txt
    

  • 将加密的文件发送到Windows.

  • Send the encrypted file to Windows.

    解密文件.

    gpg --batch --passphrase "myPasswordPhrase" -d -o test.dec output.enc
    

  • 在带有弹出窗口的Windows中,它再次询问我 Passphrase .我该如何避免呢?

    In Windows with a popup window it asked me the Passphrase again. How can I avoid it?

    推荐答案

    经过大量挖掘,我发现此命令禁用了Windows上的输入提示(也适用于* nix系统):

    After a lot of digging I found this command which disables the entry prompt on windows(works also for *nix systems):

    --pinentry-mode=loopback
    

    完整命令为:

    gpg --pinentry-mode=loopback --passphrase  "PASSWORD" -d -o "PATH\TO\OUTPUT" "PATH\TO\FILE.gpg"
    

    这篇关于禁止GPG命令中的密码短语提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆