def v_crl(cert): import certs.cert_loader as l certs = l.load_certificates_from_dir("trusted_certificates") # crl dl = download_crl("http://www.postsignum.cz/crl/psqualifiedca.crl") crl = decode_crl(dl) rev_certs = crl.getComponentByName("tbsCertList").getComponentByName("revokedCertificates")._value import certs.crl_verifier as v r = v.verify_crl(crl, certs[2]) import fast_rev_cert_parser as p csn = p.parse_all(rev_certs) logger.info("Numbers = %d" % len(csn)) return r
def update_revoked_list(self, crl): ''' Updates current list of revoked certificates with data from the downloaded and parsed crl. Returns number of added certificates ''' thisUpdate = str(crl.getComponentByName("tbsCertList").\ getComponentByName("thisUpdate")) nextUpdate = str(crl.getComponentByName("tbsCertList").\ getComponentByName("nextUpdate")) self.lastUpdated = thisUpdate self.nextUpdate = nextUpdate revoked = crl.getComponentByName("tbsCertList").\ getComponentByName("revokedCertificates") # parse the unparsed content for revokedCerts revoked_sns = fast_parser.parse_all(revoked._value) return self.__fill_revoked(revoked_sns)