client_cert.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:vmware-nsxlib 作者: openstack 项目源码 文件源码
def _get_cert_from_file(self, filename):
        with open(filename, 'r') as f:
            cert_pem = f.read()

        if not cert_pem:
            raise nsxlib_exceptions.CertificateError(
                msg=_("Failed to read certificate from %s") % filename)

        # validate correct crypto
        try:
            cert = crypto.load_certificate(crypto.FILETYPE_PEM, cert_pem)
        except crypto.Error:
            raise nsxlib_exceptions.CertificateError(
                msg=_("Failed to import client certificate"))

        return cert
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号