コード例 #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
ファイル: tests.py プロジェクト: yolcu360/apm-agent-python
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
ファイル: tests.py プロジェクト: yolcu360/apm-agent-python
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")