Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/cryptography/exceptions.py: 81%
26 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 07:26 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 07:26 +0000
1# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
5from __future__ import annotations
7import typing
9from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
11if typing.TYPE_CHECKING:
12 from cryptography.hazmat.bindings._rust import openssl as rust_openssl
14_Reasons = rust_exceptions._Reasons
17class UnsupportedAlgorithm(Exception):
18 def __init__(self, message: str, reason: _Reasons | None = None) -> None:
19 super().__init__(message)
20 self._reason = reason
23class AlreadyFinalized(Exception):
24 pass
27class AlreadyUpdated(Exception):
28 pass
31class NotYetFinalized(Exception):
32 pass
35class InvalidTag(Exception):
36 pass
39class InvalidSignature(Exception):
40 pass
43class InternalError(Exception):
44 def __init__(
45 self, msg: str, err_code: list[rust_openssl.OpenSSLError]
46 ) -> None:
47 super().__init__(msg)
48 self.err_code = err_code
51class InvalidKey(Exception):
52 pass