Alex Gaynor | 5951f46 | 2014-11-16 09:08:42 -0800 | [diff] [blame] | 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. |
Alex Gaynor | f1a3fc0 | 2013-11-02 14:03:34 -0700 | [diff] [blame] | 4 | |
Alex Gaynor | c37feed | 2014-03-08 08:32:56 -0800 | [diff] [blame] | 5 | from __future__ import absolute_import, division, print_function |
| 6 | |
Alex Gaynor | 738ac5a | 2013-11-02 14:10:38 -0700 | [diff] [blame] | 7 | |
Alex Stapleton | 112963e | 2014-03-26 17:39:29 +0000 | [diff] [blame] | 8 | class _Reasons(object): |
| 9 | BACKEND_MISSING_INTERFACE = object() |
Alex Stapleton | f33ccfcc | 2014-03-26 17:44:14 +0000 | [diff] [blame] | 10 | UNSUPPORTED_HASH = object() |
| 11 | UNSUPPORTED_CIPHER = object() |
| 12 | UNSUPPORTED_PADDING = object() |
Alex Stapleton | 6216357 | 2014-04-01 12:02:02 +0100 | [diff] [blame] | 13 | UNSUPPORTED_MGF = object() |
Alex Stapleton | 976945d | 2014-04-01 12:04:44 +0100 | [diff] [blame] | 14 | UNSUPPORTED_PUBLIC_KEY_ALGORITHM = object() |
Alex Stapleton | e47bafb | 2014-05-17 13:19:15 +0100 | [diff] [blame] | 15 | UNSUPPORTED_ELLIPTIC_CURVE = object() |
Paul Kehrer | 965dbbe | 2014-07-07 15:15:05 -0500 | [diff] [blame] | 16 | UNSUPPORTED_SERIALIZATION = object() |
Paul Kehrer | ae8156f | 2014-11-26 09:55:40 -1000 | [diff] [blame] | 17 | UNSUPPORTED_X509 = object() |
Alex Gaynor | 7a489db | 2014-03-22 15:09:34 -0700 | [diff] [blame] | 18 | |
| 19 | |
Alex Gaynor | 25d24de | 2014-03-01 09:36:02 -0800 | [diff] [blame] | 20 | class UnsupportedAlgorithm(Exception): |
Alex Stapleton | 5e4c8c3 | 2014-03-27 16:38:00 +0000 | [diff] [blame] | 21 | def __init__(self, message, reason=None): |
Alex Gaynor | 7a489db | 2014-03-22 15:09:34 -0700 | [diff] [blame] | 22 | super(UnsupportedAlgorithm, self).__init__(message) |
Alex Stapleton | 5e4c8c3 | 2014-03-27 16:38:00 +0000 | [diff] [blame] | 23 | self._reason = reason |
David Reid | 152d6be | 2013-11-12 16:41:13 -0800 | [diff] [blame] | 24 | |
| 25 | |
| 26 | class AlreadyFinalized(Exception): |
| 27 | pass |
Paul Kehrer | 22e80cb | 2013-11-20 21:27:00 -0600 | [diff] [blame] | 28 | |
| 29 | |
Paul Kehrer | ce9c611 | 2013-11-22 14:10:59 -0600 | [diff] [blame] | 30 | class AlreadyUpdated(Exception): |
| 31 | pass |
| 32 | |
| 33 | |
Paul Kehrer | cc9ec98 | 2013-11-21 11:21:35 -0600 | [diff] [blame] | 34 | class NotYetFinalized(Exception): |
Paul Kehrer | 22e80cb | 2013-11-20 21:27:00 -0600 | [diff] [blame] | 35 | pass |
Paul Kehrer | a4bfc08 | 2013-11-22 19:57:37 -0600 | [diff] [blame] | 36 | |
| 37 | |
| 38 | class InvalidTag(Exception): |
| 39 | pass |
Julian Krause | 2288e30 | 2013-12-17 21:26:23 -0800 | [diff] [blame] | 40 | |
| 41 | |
| 42 | class InvalidSignature(Exception): |
| 43 | pass |
Alex Gaynor | 0d62fb0 | 2014-01-24 12:19:05 -0600 | [diff] [blame] | 44 | |
| 45 | |
| 46 | class InternalError(Exception): |
| 47 | pass |
Alex Gaynor | b2774f5 | 2014-01-27 11:05:29 -0800 | [diff] [blame] | 48 | |
| 49 | |
| 50 | class InvalidKey(Exception): |
| 51 | pass |
Ayrx | a776911 | 2014-02-13 12:27:56 +0800 | [diff] [blame] | 52 | |
| 53 | |
| 54 | class InvalidToken(Exception): |
| 55 | pass |
Paul Kehrer | a9d78c1 | 2014-11-26 10:59:03 -1000 | [diff] [blame] | 56 | |
| 57 | |
| 58 | class InvalidX509Version(Exception): |
| 59 | pass |