[Zope] SimpleUserFolder and sha-crypted passwd

Chris Withers chrisw@nipltd.com
Mon, 06 Jan 2003 14:58:45 +0000


Bjørge Solli wrote:
> It works fine if I use only sql with the easy table from createTable.sql 
> and I copy all the tests/*.sql into my folder where the SUF-object is. I 
> can also change the getUsers so it gets my correct users. But my roles are 
> stored in different tables, and I have no good way of making a query 
> returning on the format SUF understands(my sql-expert is working on it 
> though;-) 

Yep, you either need to get SQL return the correct format, or just use a script, 
as you suggest:

> I encrypt the password in this way:
> 	crypted = sha.new(plaintext).hexdigest()

Is this code in a Script (Python)?

> I change the passwords I get from my database in this way:
> 	prefiks = '{SHA}'
>         passord = binascii.b2a_base64(binascii.unhexlify(crypted))[:-1]
> 	passwd = '%s%s' %(prefiks,passord)
> 
> But this does not work! I really don't understand why!

Well, break it down into steps, and see waht you're gettign at each stage. I 
can't see anything obviously bad but then I know next to nothing about SHA.

> One question I have asked is if it is possible to mix sql and py(?).

Don't know what you mean.

cheers,

Chris