blob: 23edcd02d5acc98109c20789d8b8bece534512f8 [file] [log] [blame]
Alex Gaynor5951f462014-11-16 09:08:42 -08001# 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 Gaynorf1a3fc02013-11-02 14:03:34 -07004
Alex Gaynorc37feed2014-03-08 08:32:56 -08005from __future__ import absolute_import, division, print_function
6
Alex Gaynor738ac5a2013-11-02 14:10:38 -07007
Alex Stapleton112963e2014-03-26 17:39:29 +00008class _Reasons(object):
9 BACKEND_MISSING_INTERFACE = object()
Alex Stapletonf33ccfcc2014-03-26 17:44:14 +000010 UNSUPPORTED_HASH = object()
11 UNSUPPORTED_CIPHER = object()
12 UNSUPPORTED_PADDING = object()
Alex Stapleton62163572014-04-01 12:02:02 +010013 UNSUPPORTED_MGF = object()
Alex Stapleton976945d2014-04-01 12:04:44 +010014 UNSUPPORTED_PUBLIC_KEY_ALGORITHM = object()
Alex Stapletone47bafb2014-05-17 13:19:15 +010015 UNSUPPORTED_ELLIPTIC_CURVE = object()
Paul Kehrer965dbbe2014-07-07 15:15:05 -050016 UNSUPPORTED_SERIALIZATION = object()
Paul Kehrerae8156f2014-11-26 09:55:40 -100017 UNSUPPORTED_X509 = object()
Alex Gaynor7a489db2014-03-22 15:09:34 -070018
19
Alex Gaynor25d24de2014-03-01 09:36:02 -080020class UnsupportedAlgorithm(Exception):
Alex Stapleton5e4c8c32014-03-27 16:38:00 +000021 def __init__(self, message, reason=None):
Alex Gaynor7a489db2014-03-22 15:09:34 -070022 super(UnsupportedAlgorithm, self).__init__(message)
Alex Stapleton5e4c8c32014-03-27 16:38:00 +000023 self._reason = reason
David Reid152d6be2013-11-12 16:41:13 -080024
25
26class AlreadyFinalized(Exception):
27 pass
Paul Kehrer22e80cb2013-11-20 21:27:00 -060028
29
Paul Kehrerce9c6112013-11-22 14:10:59 -060030class AlreadyUpdated(Exception):
31 pass
32
33
Paul Kehrercc9ec982013-11-21 11:21:35 -060034class NotYetFinalized(Exception):
Paul Kehrer22e80cb2013-11-20 21:27:00 -060035 pass
Paul Kehrera4bfc082013-11-22 19:57:37 -060036
37
38class InvalidTag(Exception):
39 pass
Julian Krause2288e302013-12-17 21:26:23 -080040
41
42class InvalidSignature(Exception):
43 pass
Alex Gaynor0d62fb02014-01-24 12:19:05 -060044
45
46class InternalError(Exception):
47 pass
Alex Gaynorb2774f52014-01-27 11:05:29 -080048
49
50class InvalidKey(Exception):
51 pass
Ayrxa7769112014-02-13 12:27:56 +080052
53
54class InvalidToken(Exception):
55 pass
Paul Kehrera9d78c12014-11-26 10:59:03 -100056
57
58class InvalidX509Version(Exception):
59 pass