Re: Re: Allowed characters in SRS Hash
Tom Lahti <[email protected]> Sun, 13 Aug 2006 14:46:28 -0700
| Newsgroups | gmane.mail.spam.srs.general |
|---|---|
| Message-ID | <[email protected]> |
>Jean-Pierre Schwickerath wrote:
> > I wondered if it is possible to exclude certain characters from being
> > used where doing an SRS Hash with the Mail::SRS perl module?
> > On my first try the module generated a hash that contained a slash (/).
> > Unfortunately this character is not allowed in the local part with
> > Postfix as MTA, so the bounce did not come back.
>
>I'd suggest that you write a sub-class of Mail::SRS that overrides the
>hash_create() and hash_verify() methods (which use Digest::HMAC_SHA1::
>b64digest() for the Base64 conversions) and substitutes any "/"s in the
>hash with another character, say ".". hash_verify() would have to do the
>reverse to the passed hash (i.e. undo the substitution before the hash is
>verified), of course.
Probably not. You'll want to change to a Digest subclass that
doesn't create "/", or make up your own hash altogether. Doing
simple character substitution screws up the math when verifying
it. When you reverse the substitution to verify the hash, you'll
reverse all "." into "/", which won't work if HMAC_SHA1 normally
outputs ".". Substitution will only work if HMAC_SHA1 doesn't output
the character you substitute with.
Or... isn't Postfix highly configurable? Simply change the config to
allow "/" in local parts.
--
-- =========================
Tom Lahti
Linxure Corporation
(888)489-3782
http://www.linxure.net/
-- =========================