在 Python 中保持 SSL 密钥文件打开

发布于 2024-09-07 02:15:33 字数 503 浏览 2 评论 0原文

我正在使用带有加密密钥文件的 Python 的 ssl 库。然而,每次我包装套接字时,系统都会提示我密码。

Enter PEM pass phrase:

如何只提供一次密码,并让 Python 在进程的生命周期内保持解密密钥的开放状态?

我对规范的 openssl 命令行或此功能的 C 等效项也非常感兴趣(假设它在这种情况下有帮助)。

我宁愿不诉诸使用 subprocess 并显式解码/删除解密的密钥。然而,如果没有其他选择,那么欢迎提出干净、安全的建议,以保证解密密钥的销毁和隐私。

I'm using Python's ssl library with an encrypted keyfile. However every time I wrap a socket, I'm prompted for the passphrase.

Enter PEM pass phrase:

How can I give the passphrase just once, and have Python hold the decrypted key open for the lifetime of the process?

I'm very interested in the canonical openssl command line or C equivalent for this functionality also (assuming it assists in this situation).

I'd rather not resort to using subprocess and explicitly decoding/deleting the decrypted key. However if there is no alternative, a clean, secure suggestion guaranteeing the destruction and privacy of the decrypted key is welcome.

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

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

发布评论

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

评论(1

会傲 2024-09-14 02:15:33

This issue is fixed in Python 2.7, and Python 3.2.

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