Re: Re: Allowed characters in SRS Hash

Scott Kitterman <[email protected]> Sun, 13 Aug 2006 20:07 -0400
Newsgroups gmane.mail.spam.srs.general
Message-ID <[email protected]>
On Sun, 13 Aug 2006 14:46:28 -0700 Tom Lahti <[email protected]> wrote:
>
>>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.


I think the OP needs to go back and examine his analysis.  With my Postfix 
2.2 it is allowed just fine.  I just sent a message from 
scott/[email protected] and it was sent and delivere no problem with 
Postfix on both ends and no special allowances made for "/".

Scott K