def proof_open(team, proof):
assert isinstance(proof, bytes)
proof = b64decode(proof)
claimed_chall_id = proof[2*64:].decode('utf-8')
claimed_chall = Challenge(claimed_chall_id)
chall_pk = claimed_chall['pk']
team_pk = team['sign_pk']
membership_proof = pysodium.crypto_sign_open(proof, chall_pk)
chall_id = pysodium.crypto_sign_open(membership_proof,
team_pk).decode('utf-8')
if claimed_chall_id != chall_id:
raise ValueError('invalid proof')
return claimed_chall
评论列表
文章目录