Add conversion between OpenSSL verification codes and our failure codes.
Review Request #14942 — Created March 18, 2026 and updated — Latest diff uploaded
This introduces a table mapping OpenSSL's numeric verification codes to
ourCertificateVerificationFailureCodeenum. This helps to create the
right exceptions for anSSLError.Python doesn't expose constants for any of these codes, so the numeric
values are used along with comments listing the OpenSSL error code's
typical constant.
CertificateVerificationFailureCode.for_ssl_verify_code()is used to
produce the right code based on the mapping. This will be used in
upcoming handling ofSSLErrors.
Unit tests pass.