X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/chopwood/blobdiff_plain/b5fb855f1d152ef0c52d579b96c006a63e77fd10..558d2d936e93cf72ca09f9869038cf89883c498c:/httpauth.py diff --git a/httpauth.py b/httpauth.py index 31e4ca1..739d1df 100644 --- a/httpauth.py +++ b/httpauth.py @@ -158,7 +158,10 @@ def hack_octets(s): def unhack_octets(s): """Reverse the operation done by `hack_octets'.""" pad = (len(s) + 3)&3 - len(s) - return BN.b64decode(s + '='*pad, '+$') + try: + return BN.b64decode(s + '='*pad, '+$') + except TypeError: + raise AuthenticationFailed, 'BADNONCE' def auth_tag(sec, stamp, user): """Compute a tag using secret SEC on `STAMP.USER'."""