Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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. 

4 

5 

6from enum import Enum 

7 

8 

9class _Reasons(Enum): 

10 BACKEND_MISSING_INTERFACE = 0 

11 UNSUPPORTED_HASH = 1 

12 UNSUPPORTED_CIPHER = 2 

13 UNSUPPORTED_PADDING = 3 

14 UNSUPPORTED_MGF = 4 

15 UNSUPPORTED_PUBLIC_KEY_ALGORITHM = 5 

16 UNSUPPORTED_ELLIPTIC_CURVE = 6 

17 UNSUPPORTED_SERIALIZATION = 7 

18 UNSUPPORTED_X509 = 8 

19 UNSUPPORTED_EXCHANGE_ALGORITHM = 9 

20 UNSUPPORTED_DIFFIE_HELLMAN = 10 

21 UNSUPPORTED_MAC = 11 

22 

23 

24class UnsupportedAlgorithm(Exception): 

25 def __init__(self, message, reason=None): 

26 super(UnsupportedAlgorithm, self).__init__(message) 

27 self._reason = reason 

28 

29 

30class AlreadyFinalized(Exception): 

31 pass 

32 

33 

34class AlreadyUpdated(Exception): 

35 pass 

36 

37 

38class NotYetFinalized(Exception): 

39 pass 

40 

41 

42class InvalidTag(Exception): 

43 pass 

44 

45 

46class InvalidSignature(Exception): 

47 pass 

48 

49 

50class InternalError(Exception): 

51 def __init__(self, msg, err_code): 

52 super(InternalError, self).__init__(msg) 

53 self.err_code = err_code 

54 

55 

56class InvalidKey(Exception): 

57 pass