【问题标题】:GPG unable to delete secret keyGPG 无法删除密钥
【发布时间】:2023-02-21 20:23:45
【问题描述】:

我试图删除在我的服务器中生成的 GPG 私钥和公钥。我收到一条错误消息“gpg:删除密钥失败:设备的 ioctl 不合适”。快速谷歌搜索,我输入“export 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

【问题讨论】:

    标签: gnupg


    【解决方案1】:

    我使用 python 的 gnupg 模块来创建这些密钥。阅读文档后,我找到了删除密钥的方法。

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

    【讨论】:

      【解决方案2】:

      在你的 zprofile 或 bash_profile 上试试这个:

      export GPG_TTY=$(tty)
      

      重新启动终端并尝试再次删除它。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-21
        • 2023-01-29
        • 1970-01-01
        • 2018-12-26
        • 2015-05-02
        相关资源
        最近更新 更多