res_company.py 文件源码

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

项目:odoo-brasil 作者: Trust-Code 项目源码 文件源码
def _compute_expiry_date(self):
        try:
            pfx = base64.decodestring(
                self.with_context(bin_size=False).nfe_a1_file)
            pfx = crypto.load_pkcs12(pfx, self.nfe_a1_password)
            cert = pfx.get_certificate()
            end = datetime.strptime(
                cert.get_notAfter().decode(), '%Y%m%d%H%M%SZ')
            subj = cert.get_subject()
            self.cert_expire_date = end
            if datetime.now() < end:
                self.cert_state = 'valid'
            else:
                self.cert_state = 'expired'
            self.cert_information = "%s\n%s\n%s\n%s" % (
                subj.CN, subj.L, subj.O, subj.OU)
        except crypto.Error:
            self.cert_state = 'invalid_password'
        except:
            self.cert_state = 'unknown'
            _logger.error(
                u'Erro desconhecido ao consultar certificado', exc_info=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号