我正在尝试对哈希执行致盲和揭盲。
我有:
messageHashed = md5.new('MyMessage').digest()
print 'Message MD5:%s' % messageHashed
blindSigned = loadedPublic.blind(messageHashed,123)
print 'Blinded: %s' % blindSigned
blindSigned = loadedPrivate.sign(blindSigned,loadedPrivate.n)
print 'Blinded Signed: %s' % str(blindSigned)
unblind = loadedPrivate.unblind(blindSigned,123)
print '-------------'
print 'Unblinded: %s' % unblind
verify = loadedPrivate.verify(unblind,(loadedPrivate.n,loadedPrivate.d))
print 'Verify: %s' % verify
(我之前已经加载了公钥和私钥,并且工作正常)
现在,我的问题是,当它运行时,我得到这个输出:
M<ssage MD5:?.Z?3??f2??
Blinded: ?YL⽥p??j+Z<I?vxV??{5??
??>[??? ??r?"l
??d?ڸYC????k?U?Q?????C?0?D??*T8?}?P?9~$??'?p??ZR:2? sh͓l??kXvU??d]???$?c聻?b??@?
Blinded Signed: (122872721681409041185513323026772702402844983846953530757782619983060590754290923453963299094289086410649560247540686534912830758097386690290305557644701999751846538319065094741731992734124277081554060855405114566548615303949954231396930615801829673187895538075706631646002356108979884582511973944741160960028L,)
Traceback (most recent call last):
File "NewClient.py", line 103, in <module>
unblind = loadedPrivate.unblind(blindSigned,123)
File "build/bdist.macosx-10.8-intel/egg/Crypto/PublicKey/pubkey.py", line 165, in unblind
File "build/bdist.macosx-10.8-intel/egg/Crypto/PublicKey/RSA.py", line 247, in _unblind
object = RSAobj
File "build/bdist.macosx-10.8-intel/egg/Crypto/PublicKey/_slowmath.py", line 47, in _unblind
OverflowError: cannot fit 'long' into an index-sized integer
即使 unblind 函数记录如下:
unblind(self, M, B)
unblind(M : string|long, B : string|long) : string|long
Unblind message M using blinding factor B.
它似乎不接受它。
谁能指出我正确的方向?我已经在这几个小时了。