python - 无法验证 CA 签署的 SSL 证书 python web 服务器
问题描述
这是我的 python web 服务器的示例代码:
Python Web 服务器代码(非完整版)
class LogRequests(BaseHTTPRequestHandler):
def do_GET(self):
print("GET request received from {}".format(self.client_address[0]))
self.write_response(200, {"success": True})
def do_POST(self):
print("GET request received from {}".format(self.client_address[0]))
self.write_response(200, {"success": True})
def write_response(self, status_code, json_body):
self.send_response(status_code)
self.send_header('Content-type', 'application/json')
self.end_headers()
self.write_json(json_body)
server = HTTPServer(('', 6000), LogRequests)
server.socket = ssl.wrap_socket(server.socket, keyfile=<key-file-path>, certfile=<cert-file-path>, server_side=True)
server.serve_forever()
我有 CA(让我们加密)签名证书。我还使用https://support.acquia.com/hc/en-us/articles/360004119234-Verifying-the-validity-of-an-SSL-certificate验证了 cert.pem 和 key.pem 文件的有效性.
邮递员要求:
URL: https://<hostname>:6000/
当我提交 POST 或 GET 请求时,它会显示SSL Error: Unable to verify the first certificate
错误。但是当我禁用SSL certificate verification
Postman 设置时,我可以提出请求并获得响应。
你能指导我这里有什么问题吗?有任何代码问题吗?
解决方案
我必须自己找到解决方案。
cert.pem
我不得不使用文件而不是fullchain1.pem
文件。
推荐阅读
- r - 对列中的值求和并按 R 中的另一列分组
- android - 如何将 .onViewAdded 与约束布局一起使用
- python - Spyder4找不到seaborn包
- actions-on-google - 如何将“自由格式文本”类型从区分大小写更改?
- dfa - 用于 Kleene 星操作的 DFA
- javascript - 在 Google 表格中解析表格,然后将所有匹配的行数据存储在一个数组中,我可以从中提取信息(GAS/JavaScript)
- opencv - 这是 ARUCO 板估计的正常不稳定量吗?(视频示例)
- html - 垂直菜单中的图像未与菜单容器对齐
- javascript - 如何通过ajax调用数据来扩展表格行以获取更多信息
- python - 安装 PyAudio 给出错误“portaudio.h”文件未找到