Blocking is implemented by a pretty straightforward loop, memcmp'ing against the hard-coded `unsigned char _distrusted_spki[][SHA256_DIGEST_LENGTH]`. As explained in comments:
* This is an extraordinary measure and last line of defense. Removing trust is * primarily the job of the platform root store. This list only blocks keys while * that update is still propagating to the OS, container images, or root CAs * bundled in Python packages. The threshold for adding an entry is very high.
There's also an amusing workaround for security scanners that might trip on the tests included in the source release. From the code comment:
> The distrusted test material… lives in a password-protected zip so it doesn't trip security scanners that cannot tell internal test fixtures from production secrets and flag any certificate or private key they find. It is encrypted, not merely zipped, because such scanners read inside plain archives. The password is fixed, public, and not a secret.
What might that non-secret password be, you ask? Well, this is Python, so of course:
DISTRUSTED_ZIP_CHOSEN_KNIGHT = 'Brave Sir Robin'
[0]: https://discuss.python.org/t/_/109576/60[1]: https://github.com/python/cpython/commit/7dd8b4736a1419750b94a388e6d158be15836fe6
[2]: https://github.com/python/cpython/issues/160040