예제 #1
0
 def cert_fingerprint(self):
     if self._server_cert:
         with open(self._server_cert, "rb") as f:
             cert_data = read_pem_file(f)
         digest = hashlib.sha256()
         digest.update(cert_data)
         return digest.hexdigest()
     return None
예제 #2
0
def test_read_pem_file_chain():
    with open(os.path.join(os.path.dirname(__file__), "..", "ca", "chain.crt"),
              mode="rb") as f:
        result = read_pem_file(f)
        assert result.endswith(b"\xc8\xae")
예제 #3
0
def test_read_pem_file():
    with open(os.path.join(os.path.dirname(__file__), "..", "ca", "ca.crt"),
              mode="rb") as f:
        result = read_pem_file(f)
        assert result.startswith(
            b"0\x82\x05{0\x82\x03c\xa0\x03\x02\x01\x02\x02\x14")