Пример #1
0
    def verify_lrs_signature(self, client_msg, client_sig):
        """Verifies whether the LRS signature is valid."""

        # modify copy of stp_array to prevent duplicate voting
        stp_array = list(self.stp_array)
        stp_array.append(msg_hash(client_msg, sha1))

        return lrs.verify(client_msg, stp_array, *client_sig, g=self.generator)
Пример #2
0
# get the public keys for all ids in anon set
pubkeys = range(setsize)
for i in range(setsize):
	key = getpub(anonset[i])
	pubkeys[i] = key
	print key

	
# get LRS signature
# add private key to list of pub keys
pos = random.StrongRandom().randint(0,len(pubkeys))
L = pubkeys[:pos]+[comppub]+pubkeys[pos:]
# message to sign

f = open('ogst.pdf','rb')
msg1 = f.read()
m = msg1
print verify(sign(m,L,comppriv,pos),m)
print










Пример #3
0
	def verify_lrs_signature(self, client_msg, client_sig):
		# modify copy of ltp_array to prevent duplicate voting
		ltp_array = list(self.ltp_list.keys())
		ltp_array.append(msg_hash(client_msg, sha1))

		return lrs.verify(client_msg, ltp_array, *client_sig)
Пример #4
0
"""
# get LRS signature
# add private key to list of pub keys
pos = random.StrongRandom().randint(0,len(pubkeys))
L = pubkeys[:pos]+[comppub]+pubkeys[pos:]
anonset = anonset[:pos]+[id]+anonset[pos:]
print anonset
"""
# message to sign

f = open(filename,'rb')
m = f.read()
# get the signature
s1 = sign(m,pubs,comppriv,z)
print verify(s1,m,pubs)
print

# save the signature to file
f = open('sigs/' + filename[7:] + '.sig','w')
# save the list of facebook ids, their corresponding public keys, and the signature
pickle.dump([ids,pubs,s1],f)