a module for errors

This commit is contained in:
meejah 2019-06-24 12:05:12 -06:00
parent 58e0b27374
commit 5701bad548
6 changed files with 22 additions and 18 deletions

View File

@ -31,10 +31,9 @@ from cryptography.hazmat.primitives.serialization import (
PublicFormat,
)
from allmydata.crypto import (
remove_prefix,
BadSignature,
)
from allmydata.crypto.util import remove_prefix
from allmydata.crypto.error import BadSignature
from allmydata.util.base32 import (
a2b,
b2a,

View File

@ -0,0 +1,15 @@
"""
Exceptions raise by allmydata.crypto.* modules
"""
class BadSignature(Exception):
"""
An alleged signature did not match
"""
class BadPrefixError(Exception):
"""
A key did not start with the required prefix
"""

View File

@ -5,7 +5,7 @@ from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives.serialization import load_der_private_key, load_der_public_key, \
Encoding, PrivateFormat, PublicFormat, NoEncryption
from allmydata.crypto import BadSignature
from allmydata.crypto.error import BadSignature
"""

View File

@ -2,17 +2,7 @@
Utilities used by allmydata.crypto modules
"""
class BadSignature(Exception):
"""
An alleged signature did not match
"""
class BadPrefixError(Exception):
"""
A key did not start with the required prefix
"""
from allmydata.crypto.error import BadPrefixError
def remove_prefix(s_bytes, prefix):

View File

@ -9,7 +9,7 @@ from allmydata.introducer.common import sign_to_foolscap, unsign_from_foolscap,\
get_tubid_string_from_ann
from allmydata.util import log, yamlutil, connection_status
from allmydata.util.rrefutil import add_version_to_remote_reference
from allmydata.crypto import BadSignature
from allmydata.crypto.error import BadSignature
from allmydata.util.assertutil import precondition
class InvalidCacheError(Exception):

View File

@ -8,7 +8,7 @@ from twisted.internet import defer
from twisted.python import failure
from foolscap.api import DeadReferenceError, RemoteException, eventually, \
fireEventually
from allmydata.crypto import BadSignature
from allmydata.crypto.error import BadSignature
from allmydata.crypto import rsa
from allmydata.util import base32, hashutil, log, deferredutil
from allmydata.util.dictutil import DictOfSets