[Checkins] SVN: zope.app.authentication/branches/ulif-saltfix/src/zope/app/authentication/password.py Test slappasswd compatibility.

Uli Fouquet uli at gnufix.de
Wed Jan 21 08:16:55 EST 2009


Log message for revision 94900:
  Test slappasswd compatibility.

Changed:
  U   zope.app.authentication/branches/ulif-saltfix/src/zope/app/authentication/password.py

-=-
Modified: zope.app.authentication/branches/ulif-saltfix/src/zope/app/authentication/password.py
===================================================================
--- zope.app.authentication/branches/ulif-saltfix/src/zope/app/authentication/password.py	2009-01-21 12:29:58 UTC (rev 94899)
+++ zope.app.authentication/branches/ulif-saltfix/src/zope/app/authentication/password.py	2009-01-21 13:16:55 UTC (rev 94900)
@@ -170,6 +170,19 @@
     >>> manager.checkPassword(encoded, password + u"wrong")
     False
 
+    Using the `slappasswd` utility to encode ``secret``, we get
+    ``{SSHA}J4mrr3NQHXzLVaT0h9TuEWoJOrxeQ5lv`` as seeded hash.
+
+    Our password manager generates the same value when seeded with the
+    same salt, so we can be sure, our output is compatible with
+    standard LDAP tools that also use SSHA::
+    
+    >>> from base64 import urlsafe_b64decode
+    >>> salt = urlsafe_b64decode('XkOZbw==')
+    >>> encoded = manager.encodePassword('secret', salt)
+    >>> encoded
+    '{SSHA}J4mrr3NQHXzLVaT0h9TuEWoJOrxeQ5lv'
+    
     >>> encoded = manager.encodePassword(password)
     >>> manager.checkPassword(encoded, password)
     True



More information about the Checkins mailing list