def _decode_ocsp_response_cache(ocsp_response_cache_json, ocsp_response_cache): """ Decodes OCSP response cache from JSON """ current_time = int(time.time()) for cert_id_base64, (ts, ocsp_response) in ocsp_response_cache_json.items(): cert_id = CertId.load(b64decode(cert_id_base64)) hkey = _decode_cert_id_key(cert_id) if current_time - CACHE_EXPIRATION <= ts: # creation time must be new enough ocsp_response_cache[hkey] = (ts, b64decode(ocsp_response)) elif hkey in ocsp_response_cache: # invalidate the cache if exists del ocsp_response_cache[hkey] global OCSP_VALIDATION_CACHE_UPDATED OCSP_VALIDATION_CACHE_UPDATED = True
def decode_cert_id_base64(self, cert_id_base64): return CertId.load(b64decode(cert_id_base64))