[Nym3-commit] r192 - trunk/nym3/Server

laurent at conuropsis.org laurent at conuropsis.org
Mon Apr 11 21:51:46 CEST 2005


Author: laurent
Date: 2005-04-11 21:51:44 +0200 (Mon, 11 Apr 2005)
New Revision: 192

Modified:
   trunk/nym3/Server/Main.py
   trunk/nym3/Server/User.py
Log:
Fix "SURB have a fixed size" assumptions in the server.


Modified: trunk/nym3/Server/Main.py
===================================================================
--- trunk/nym3/Server/Main.py	2005-04-11 19:48:58 UTC (rev 191)
+++ trunk/nym3/Server/Main.py	2005-04-11 19:51:44 UTC (rev 192)
@@ -64,7 +64,7 @@
     - run appropriate actions"""
     #TODO prendre le numero de sequence pour pouvoir l'aquitter
     
-    def MyException(Exception): pass
+    class MyException(Exception): pass
     
     sr = Message.StrReader(msg)
     try:

Modified: trunk/nym3/Server/User.py
===================================================================
--- trunk/nym3/Server/User.py	2005-04-11 19:48:58 UTC (rev 191)
+++ trunk/nym3/Server/User.py	2005-04-11 19:51:44 UTC (rev 192)
@@ -237,8 +237,10 @@
             return ec
 
     def clean_surbs(self):
-	"""Inspect the surbs and delete the used/outdated
-	TODO use client API when implemented"""
+	"""Inspect the surbs and delete the used/outdated"""
+	pass
+	# TODO : this function relied on the false assumption that
+	# SURBs have fixed length. A rewrite is needed.
 	fname = self.surbfile()
 	f = open(fname, "r")
 	buffer = f.read()
@@ -272,7 +274,8 @@
 	f = open(fname, "a")
 	f.write(surbs)
 	f.close()
-	self.data['nSurbs'] = self.data['nSurbs'] + ( len(surbs) / surb_len)
+	#self.data['nSurbs'] = self.data['nSurbs'] + ( len(surbs) / surb_len)
+	# TODO : we need a _correct_ way to calculate the number of SURBs.
 
     def delSurbs(self):
 	"""Deletes all the surbs of the surb store"""
@@ -415,9 +418,7 @@
 	the public key of this user"""
 	try:
 	    key = _cr.pk_decode_public_key(self['idKey'])
-	    sig = s[:len(s) - key.get_modulus_bytes()]
-	    print "Sig has length %s" % len(sig)
-	    return (_cr.sha1(m) == _cr.pk_check_signature(sig, key))
+	    return (_cr.sha1(m) == _cr.pk_check_signature(s, key))
 	except _cr.CryptoError: return False
 	    
     def checkChallenge(self, cr):



More information about the Nym3-commit mailing list