def test_wildcard_ocsp_bypass_ssd(): """ Clean any skeletons of past tests """ _teardown_ssd_test_setup() """ Setup OCSP instance to use test keys for authenticating SSD """ priv_key = _get_test_priv_key(1) ts = int(time.time()) hostname = 'sfcsupport.us-east-1.snowflakecomputing.com' tmp_dir = str(tempfile.gettempdir()) temp_ocsp_file_path = path.join(tmp_dir, "ocsp_cache_backup.json") temp_ocsp_obj = SFOCSP() cid = temp_ocsp_obj.encode_cert_id_base64(ret_wildcard_hkey()) ssd = _create_cert_spec_ocsp_bypass_token(priv_key, cid) js_ssd = {} with codecs.open(OCSP_RESPONSE_CACHE_URI, "r", encoding='utf-8', errors='ignore') as f: js = json.load(f) js.update({cid: [ts, b64encode(ssd).decode('ascii')]}) with codecs.open(temp_ocsp_file_path, "w", encoding='utf-8', errors='ignore') as f_ssd: json.dump(js_ssd, f_ssd) ocsp = _setup_ssd_test(temp_ocsp_file_path) connection = _openssl_connect(hostname) assert (ocsp.validate(hostname, connection), "Failed to validate {} using Wildcard OCSP Bypass SSD".format( hostname))
def __init__(self, **kwargs): super(SnowflakeOCSPPyasn1, self).__init__(**kwargs) self.WILDCARD_CERTID = self.encode_cert_id_key(ret_wildcard_hkey())