Support loading keys and certificates as variables (bytes) in particular in the load_cert_chain function
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Proposal:
In MutualTLS Authentication scenarios it's useful to maintain client credential (private_key) confidentiality by allowing loading of the credential from encrypted key archives for example PKCS12. Python Cryptography and other modules allow loading of private keys into memory and at present we need to write those sensitive files to disk temporarily in order to load them into our TLS Client context.
This appears to be the existing code https://github.com/python/cpython/blob/a9c304cf020e2fa3ae78fd88359dfc808c9dd639/Modules/_ssl.c#L3899
if (keyfile && !PyUnicode_FSConverter(keyfile, &keyfile_bytes)) {
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
PyErr_SetString(PyExc_TypeError,
"keyfile should be a valid filesystem path");
}
goto error;
}
Has this already been discussed elsewhere?
There is one somewhat similar feature request relating to loading from PKCS11 tokens. This is not related.
Links to previous discussion of this feature:
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 Modules/_ssl.c 中的 load_cert_chain 实现以及 issue 中所示的文件系统路径转换开始。检查当前函数如何接受密钥和证书路径,然后确定内存中字节输入所需的 API 和测试覆盖范围。当凭据可以从字节加载而无需临时敏感文件时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, python
- 领域
- authentication, security
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100