Support loading keys and certificates as variables (bytes) in particular in the load_cert_chain function
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong Modules/_ssl.c, tại phần triển khai load_cert_chain và phần chuyển đổi đường dẫn hệ thống tệp được hiển thị trong issue. Xem lại cách hàm hiện tại tiếp nhận các đường dẫn khóa và chứng chỉ, sau đó xác định API và phạm vi kiểm thử cần thiết cho các đầu vào byte trong bộ nhớ. Công việc được hoàn tất khi thông tin xác thực có thể được tải từ byte mà không yêu cầu các tệp tạm thời nhạy cảm.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, python
- Lĩnh vực
- authentication, security
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100