Skip to content

Implement experimental support for public key pinning #24

Closed
@sethmlarson

Description

@sethmlarson

In CPython 3.10 there were private APIs SSLObject.get_verified_chain() and _ssl.Certificate.public_bytes(_ssl.ENCODING_DER) methods added.

Ref: python/cpython#25467

import hashlib
import _ssl
fingerprints = [hashlib.sha256(cert.public_bytes(_ssl.ENCODING_DER)).hexdigest() for cert in sock._sslobj.get_verified_chain()]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions