On 16/dic/2009, at 20.01, Nick Douma wrote: > On 16-12-2009 17:11, Andre wrote: >> Hi to all! >> I’m writing a python module (python+sqlalchemy) to manage user and domain >> configuration on my system (I hope to get a CLI tool, a Web app and even a >> native Mac app, via PyObjc, from my lib). >> I’m implementing password crypto, but I have some problem in generating >> CRAM-MD5 password, dovecot style. >> I’ve found an old discussion on this mailing list and a piece of Perl that >> works, but I need to implement it in Python; I’ve even read code >> (hmac-md5.c), but before start hard coding (hard from my POV at least, since >> I’ve never worked with crypto algorithms in a deep way), is there anyone >> that have had solved the problem or has any idea on how to approach it? >> >> TIA >> Andre > > If the module is always going to run on a machine with dovecot > installed, you could call from your script: > > $ dovecotpw -s CRAM-MD5 -p <password> > I know, I thought to do in this way, but it introduces an unnecessary and strong dependency. Imagine of a web server running the administration interface, that is not even the IMAP server (I know I can install only common dovecot components) or imagine to write a OSX/Windows Administration tool (I would like to write a Xcode/PyOBjc tool).
Anyway, I’ll give a try to module hmac. Andre