tc-openssl.py 文件源码

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

项目:python-gnutls 作者: AGProjects 项目源码 文件源码
def __new__(typ, value):
        if isinstance(value, basestring):
            path = process.config_file(value)
            if path is None:
                log.warn("Private key file '%s' is not readable" % value)
                return None
            try:
                f = open(path, 'rt')
            except:
                log.warn("Private key file '%s' could not be open" % value)
                return None
            try:
                try:
                    return crypto.load_privatekey(crypto.FILETYPE_PEM, f.read())
                except crypto.Error, e:
                    log.warn("Private key file '%s' could not be loaded: %s" % (value, str(e)))
                    return None
            finally:
                f.close()
        else:
            raise TypeError, 'value should be a string'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号