[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tmda-cvs
Subject:    CVS: tmda/TMDA ChangeLog,1.72,1.73 Cookie.py,1.9,1.10
From:       "Jason R. Mastaler" <jasonrm () users ! sourceforge ! net>
Date:       2001-10-24 0:00:28
[Download RAW message or body]

Update of /cvsroot/tmda/tmda/TMDA
In directory usw-pr-cvs1:/tmp/cvs-serv22234/TMDA

Modified Files:
	ChangeLog Cookie.py 
Log Message:
Implement 'keyword' style tagged addresses.  

(e.g, jason-keyword.HMAC@mastaler.com)

The HMAC is based upon only the keyword, so a valid keyword address
will work for any sender and indefinitely unless specifically revoked.

Essentially, if the tag doesn't match confirm/dated/sender, then it
defaults to a 'keyword' address.  If it can't be verified, it's
considered invalid.

This feature was suggested by Matt Armstrong and implemented by Matt
Armstrong and Jason R. Mastaler.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- ChangeLog	2001/10/17 23:19:32	1.72
+++ ChangeLog	2001/10/24 00:00:26	1.73
@@ -1,3 +1,9 @@
+2001-10-23  Jason R. Mastaler  <jasonrm@nightshade.la.mastaler.com>
+
+	* Cookie.py (make_keywordmac, make_keyword_cookie,
+	make_keyword_address): New functions to return an HMAC, a cookie,
+	and an e-mail address based on a 'keyword'.
+
 2001-10-17  Jason R. Mastaler  <jasonrm@nightshade.la.mastaler.com>
 
 	* Defaults.py (TMDA_VERSION): Begin 0.39 development.

Index: Cookie.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Cookie.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Cookie.py	2001/10/02 23:34:48	1.9
+++ Cookie.py	2001/10/24 00:00:26	1.10
@@ -81,3 +81,24 @@
     sender_address = username + Defaults.RECIPIENT_DELIMITER + 'sender' + \
                      Defaults.RECIPIENT_DELIMITER + sender_cookie + '@' + hostname
     return sender_address
+
+
+def make_keywordmac(keyword):
+    """Expects a keyword as a string, returns an HMAC in hex."""
+    keywordmac = HMAC.new(Defaults.CRYPT_KEY, keyword).digest()[:Defaults.HMAC_BYTES]
+    return Util.hexlify(keywordmac)
+
+
+def make_keyword_cookie(keyword):
+    """Return a keyword-style cookie (keyword + HMAC)."""
+    keywordmac = make_keywordmac(keyword)
+    return keyword + '.' + keywordmac
+
+
+def make_keyword_address(address, keyword):
+    """Return a full keyword-style e-mail address."""
+    keyword_cookie = make_keyword_cookie(keyword)
+    (username, hostname) = string.split(address,'@')
+    keyword_address = username + Defaults.RECIPIENT_DELIMITER + \
+                     keyword_cookie + '@' + hostname
+    return keyword_address

_______________________________________________
tmda-cvs mailing list
http://libertine.org/lists/listinfo/tmda-cvs

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic