Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Digest-MD5 for Python 3.6+ #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

derula
Copy link
Contributor

@derula derula commented Feb 4, 2023

This code was still very much Python 2 only.

A word on why I used latin encoding:

This is a synonym for iso-8859-1 which is the default encoding used in RFC-2831 (Digest MD5 SASL).

Now, Digest-MD5 SASL supports UTF-8 too, but with some caveats. As far as I understand, UTF-8 can only be used under the following conditions:

  • Only if the challenge includes charset=UTF-8
  • Only if the challenge response also includes charset=UTF-8
  • Either value username-value, realm-value, passwd may only be UTF-8 encoded before hashing if they contain any non-ISO-8859-1 character in them, otherwise the hash must be calculated from the ISO-8859-1 encoding.

Since none of this logic exists in the current implementation, I decided to only use latin. Anything else would be a new feature.

Cf. RFC 2831

Note: This is mostly untested because I couldn't connect to my test server that supports Digest-MD5 with sievelib, even after manually switching to PLAIN/LOGIN. It works with other ManageSieve clients, so I assume there is another, perhaps unrelated, bug in this library somewhere. Honestly, I don't have the time to fully track down that issue and will likely be using the other client going forward. However, with these changes, it did at least try to connect without raising random exceptions, so I wanted to at least share my effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant