def read_file(self, subject_name, pw=None):
"""
???? ???
:param subject_name: ??? ??? ??? ??
:return: ??? ???
"""
pem_path = os.path.join(os.path.dirname(__file__),
"../../resources/unittest/" + subject_name + "/cert.pem")
f = open(pem_path, "rb")
cert_pem = f.read()
f.close()
cert = x509.load_pem_x509_certificate(cert_pem, default_backend())
key_path = os.path.join(os.path.dirname(__file__),
"../../resources/unittest/" + subject_name + "/key.pem")
f = open(key_path, "rb")
cert_key = f.read()
f.close()
private_key = serialization.load_pem_private_key(cert_key, pw, default_backend())
return {'cert': cert, 'private_key': private_key}
test_certificate_authorization.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录