Skip to content

Implement experimental support for public key pinning #24

Closed

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()]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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