reviewboard.certs.errors¶
Certificate-related errors.
New in version 6.0.
- class CertificateVerificationFailureCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
IntEnum
Error codes indicating a SSL/TLS certificate verification failure.
These represent the main types of verification errors that Review Board may be able to automatically handle or present to the user in some form.
There is no guarantee of a one-to-one mapping of failure codes to OpenSSL or SCM-specific SSL failures.
The raw enum values should be considered opaque. Please refer only to the names.
New in version 6.0.
- NOT_TRUSTED = 0[source]¶
The certificate is not trusted.
This may be self-signed or using an unknown Certificate Authority.
- __format__(format_spec, /)¶
Default object formatter.
- __new__(value)¶
- exception BaseCertificateError[source]¶
Bases:
Exception
Base class for all SSL/TLS certificate errors.
New in version 6.0.
- exception InvalidCertificateError[source]¶
Bases:
BaseCertificateError
An error indicating an invalid/unsupported certificate file format.
New in version 6.0.
- __annotations__ = {}¶
- exception CertificateStorageError[source]¶
Bases:
BaseCertificateError
An error indicating a problem accessing or storing certificate data.
New in version 6.0.
- __annotations__ = {}¶
- exception CertificateNotFoundError(msg: Optional[str] = None)[source]¶
Bases:
CertificateStorageError
An error indicating a certificate data was not found.
New in version 6.0.
- __init__(msg: Optional[str] = None) None [source]¶
Initialize the error.
- Parameters:
msg (
str
, optional) – The optional custom error message.
- __annotations__ = {}¶
- exception InvalidCertificateFormatError(msg: Optional[str] = None, *, data: bytes, path: Optional[str] = None)[source]¶
Bases:
CertificateStorageError
An error indicating an invalid/unsupported certificate file format.
New in version 6.0.
- __init__(msg: Optional[str] = None, *, data: bytes, path: Optional[str] = None) None [source]¶
Initialize the error.
- __annotations__ = {'data': 'bytes', 'path': 'Optional[str]'}¶
- exception CertificateVerificationError(msg: Optional[str] = None, *, code: CertificateVerificationFailureCode, certificate: Optional[Certificate] = None, detail_msg: Optional[str] = None)[source]¶
Bases:
BaseCertificateError
An error indicating that certificate could not be verified.
This is used to communicate that a certificate could not be verified, allowing code to present the verification error to a user or attempt a retry.
New in version 6.0: This replaces the legacy
reviewboard.scmtools.errors.UnverifiedCertificateError
.- generic_msg: str¶
A generic message for the certificate error.
This won’t include the extra certificate details, allowing a handler to represent those details separately.
- Type:
- __init__(msg: Optional[str] = None, *, code: CertificateVerificationFailureCode, certificate: Optional[Certificate] = None, detail_msg: Optional[str] = None) None [source]¶
Initialize the error message.
This will compute a suitable default error message, based on the certificate and any failures.
- Parameters:
msg (
str
, optional) – An explicit error message to display.code (
CertificateVerificationFailureCode
) – A verification code specifying the reason for the failure.detail_msg (
str
, optional) –An optional detailed message specifying why the certificate was not verified.
This may represent an underlying error string from OpenSSL or another library.
certificate (
reviewboard.certs.cert.Certificate
, optional) – The certificate details being presented, if any.
- __annotations__ = {'certificate': 'Optional[Certificate]', 'code': 'CertificateVerificationFailureCode', 'detail_msg': 'Optional[str]', 'generic_msg': 'str'}¶
- certificate: Optional[Certificate]¶
The certificate details being presented, if available.
- code: CertificateVerificationFailureCode¶
The reason the certificate could not be verified.
- detail_msg: Optional[str]¶
Detailed text specifying why the certificate was not verified.
This may represent an underlying error string from OpenSSL or another library.
- Type:
- build_message(msg: Optional[str]) str [source]¶
Return a message for the error.
This will compute details to show in the error message, and provide a default error message if one is not provided.
Error messages may contain the following format string indicators:
%(code)s
:The error code identifying the problem.
%(hostname)s
:The hostname reflected in the certificate.
Subclasses can override this or provide custom format messages in order to more accurately represent certificate failures.