如何在使用 gpgme 解密文件时绕过 pinentry(密码屏幕)

发布于 2024-12-23 09:06:21 字数 369 浏览 3 评论 0原文

我正在尝试从服务器解密文件,我拥有该服务器所需的公钥。密钥环具有密码保护,因此当我尝试解密文件时,它会要求我输入密码。

当我们尝试解密文件时,有没有办法通过传递密码来绕过该密码。

我正在使用 gpg-agent,其中密码默认缓存 600 秒,由于某种原因,我无法设置 max-cache-ttl(它不起作用)对我来说,我不知道 y) 并且仅适用于该会话。

现在我想缓存我正在使用 gpg-preset-passphrase 的密码。我在 .gnupg/gpg-agent.conf 中将其设置为 gpg-preset-passphrase --preset hex。我不知道我在这方面缺少什么。

有人可以让我知道我在这方面缺少什么吗?

I am trying to decrypt a file from the server where I have the required public key of that server. The keyring has a password protection and so when I try to decrypt a file, it asks me for a passphrase.

Is there a way to bypass that passphrase by passing the password when we try to decrypt the file.

I am using gpg-agent where the passphrase is cached for 600sec default time and for some reason I am unable to set the max-cache-ttl (It didn't work for me, I don't know y) and is availble only for that session.

Now I want to cache the passphrase for which I am using gpg-preset-passphrase. I set it in .gnupg/gpg-agent.conf as gpg-preset-passphrase --preset hex. I don't know what I am missing in this.

Can someone please let me know what I am missing in this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

君勿笑 2024-12-30 09:06:21

我无法绕过密码或 pinentry 屏幕,但我使用 gpg-agent 选项(如 default-cache-ttl)来设置缓存时间。因此,从第二次尝试开始,pinentry 将检索缓存的密码并重置 default-cache-ttl 上的计时器。

还有一个名为 max-cache-ttl 的选项,即使在成功检索缓存密码并重置 default-cache-ttl 后,该选项也不会更改其计时器,并且会在之后使缓存密码过期。设置的超时时间。

例如:如果我将它们都设置为 10 小时(即 36000 秒),如果我在 5 小时后调用解密,则默认将重置其计时器,现在我们还有 10 个小时。但最大值将在最初 10 小时后过期,因此会在 10 小时后删除缓存的密码。

我发现的另一个问题是 gpg-agent 的会话问题。即,如果我打开一个新会话并尝试解密,则不会发生这种情况,并且会错误提示 gpg-agent 对于该会话不可用。我编写了一些 shell 脚本并将其放在 bashrc 上,以便它在新会话启动时立即启动

I am unable to bypass the passphrase or pinentry screen, but I used gpg-agent options like default-cache-ttl to set the cache time. So that from the second attempt, the pinentry is going to retrieve the cached passphrase and will reset the timer on defaul-cache-ttl.

There is one more called max-cache-ttl option, even after the successfull retrieval of cached passphrase and reset of default-cache-ttl, this option doesn't change its timer and expires the cached passphrase after the set timeout.

For ex: If I set both of them for 10hrs (i.e., 36000sec), if I call the decrypt after 5hrs, default is going to reset its timer and now we have 10more hours. But the max is going to expire after the initial 10hours and thus removes the cached passphrase after 10hours.

One more problem I found is, session issue with gpg-agent. i.e., if I open a new session and try to decrypt, it doesn't happen and errors out that gpg-agent is not available for this session. I wrote some shell script and put it on bashrc so that it starts as soon as a new session is started

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文