[Nym3-commit] r108 - trunk

nym3-devel@lists.noreply.org nym3-devel@lists.noreply.org
Wed, 18 Aug 2004 16:57:34 +0200


Author: jr
Date: 2004-08-18 16:57:34 +0200 (Wed, 18 Aug 2004)
New Revision: 108

Modified:
   trunk/User.py
Log:
- change the way mixminion.Crypto is imported
- implement correctly the check of the signature


Modified: trunk/User.py
===================================================================
--- trunk/User.py	2004-08-18 14:49:12 UTC (rev 107)
+++ trunk/User.py	2004-08-18 14:57:34 UTC (rev 108)
@@ -10,7 +10,7 @@
 import time
 import mixminion.Common
 from Message import intToStrBE
-from mixminion.Crypto import pk_from_modulus
+import mixminion.Crypto as _cr
 
 surb_len = Common.surbLength
 lifeCycle = Common.lifeCycle
@@ -325,8 +325,8 @@
 
     def setKeys(self, kid, kenc):
         """given 2 modulus (int) set the public keys of the user"""
-	self.data['idKey'] = pk_from_modulus(kid)
-	self.data['encKey'] = pk_from_modulus(kenc)
+	self.data['idKey'] = _cr.pk_from_modulus(kid)
+	self.data['encKey'] = _cr.pk_from_modulus(kenc)
 
     def isInitialized(self):
 	"""True if the first 3 commands :
@@ -343,7 +343,7 @@
 	self['up'] = True
 
     def checkMessageSign(self, m, s):
-        return (s == Crypto.pk_check_signature(m, self.idKey()))
+        return (s == _cr.pk_check_signature(_cr.sha1(m), self.idKey()))
 	    
     def checkChallenge(self, cr):
         return (self['cr'] == cr)