GPG无法删除密钥

  • 本文关键字:密钥 删除 GPG gnupg
  • 更新时间 :
  • 英文 :


我试图删除服务器中生成的GPG私钥和公钥。我犯了一个错误,说";gpg:删除密钥失败:设备的ioctl不合适;。在谷歌上快速搜索后,我输入了";导出GPG_TTY=$(TTY(";以修复ioctl错误。

现在,当我再次尝试删除密钥时,它错误地显示为";gpg:删除密钥失败:没有这样的文件或目录"。你们以前遇到过这种情况吗?

root@blahblah:/# gpg --delete-secret-keys 840AF4E6
gpg (GnuPG) 2.2.27; Copyright (C) 2021 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

sec  rsa2048/34D79E35840AF4E6 2022-02-23 Autogenerated Key <email@company.com>
Delete this key from the keyring? (y/N) Y
This is a secret key! - really delete? (y/N) Y
gpg: deleting secret key failed: No such file or directory
gpg: 840AF4E6: delete key failed: No such file or directory

我使用python的gnupg模块来创建这些键。看完文档后,我找到了一种删除密钥的方法。

print(str(gpg.delete_keys('ED353CD1B038A91F103B005534D79E35840AF4E6', True, passphrase = "mypassphrase")))
ok

在zprofile或bashprofile上试试这个:

export GPG_TTY=$(tty)

重新启动终端,然后再次尝试删除它。

最新更新