zope.password SSHAPasswordManager cannot handle unicode?

Jan-Wijbrand Kolman <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Hi,

When I define a principal in my site.zcml and have it use the 
SSHAPasswordManager, I cannot login as a "TypeError: character mapping 
must return integer, None or unicode" is raised in the checkPassword() 
methid. It took me quite a while to figure out what was going on...

The site.zcml contains the encoded password for the principal that will 
be "contained" in the global principalregistry. When trying to login, 
the encoded password is taken from the principal object created from the 
information in site.zcml, and it makes sense that the encoded password 
will be an unicode string.

However the checkPassword() method of the SSHAPasswordManager cannot 
handle unicode or, more specifically, it will call 
base64.urlsafe_b64decode() on it that cannot handle unicode strings (or 
at least not in this case).

I my assesment is correct, then I must conclude no one is using the 
SSHAPasswordManager? But maybe there's something I don't understand 
about what is going wrong here...

Anyway, I guess I could fix this by have the encoded password encoded to 
ascii first before passing it to uurlsafe_b64decode. I think this would 
be safe, as the encoded password would not contain non-ascii characters 
anyway, right?

regards, jw

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.