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 06:05 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:05 +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__(
19 self, message: str, reason: typing.Optional[_Reasons] = None
20 ) -> None:
21 super().__init__(message)
22 self._reason = reason
25class AlreadyFinalized(Exception):
26 pass
29class AlreadyUpdated(Exception):
30 pass
33class NotYetFinalized(Exception):
34 pass
37class InvalidTag(Exception):
38 pass
41class InvalidSignature(Exception):
42 pass
45class InternalError(Exception):
46 def __init__(
47 self, msg: str, err_code: typing.List[rust_openssl.OpenSSLError]
48 ) -> None:
49 super().__init__(msg)
50 self.err_code = err_code
53class InvalidKey(Exception):
54 pass