예제 #1
0
 def deserialize(json):
     asc = dumps(json).encode('ascii')
     c_str = ffi.new('char[]', asc)  # freed by cffi
     obj = lib.encryption_key_new_deserialize(c_str)
     if obj == ffi.cast('struct EncryptionKey *', 0):
         raise Exception('could not deserialize')
     return EncryptionKey(obj)
예제 #2
0
 def deserialize(json):
     asc = dumps(json).encode('ascii')
     c_str = ffi.new('char[]', asc)  # freed by cffi
     obj = lib.bigint_new_deserialize(c_str)
     if obj == ffi.cast('struct BigInt *', 0):
         raise Exception('could not deserialize')
     return BigInt(obj)
예제 #3
0
 def deserialize(json):
     asc = dumps(json).encode('ascii')
     c_str = ffi.new('char[]', asc)  # freed by cffi
     obj = lib.p2partialsig_new_deserialize(c_str)
     if obj == ffi.cast('struct PartialSig *', 0):
         raise Exception('could not deserialize')
     return P2PartialSig(obj)
예제 #4
0
 def deserialize(json):
     asc = dumps(json).encode('ascii')
     c_str = ffi.new('char[]', asc)  # freed by cffi
     obj = lib.challenge_new_deserialize(c_str)
     if obj == ffi.cast('struct Challenge *', 0):
         raise Exception('could not deserialize')
     return Challenge(obj)
예제 #5
0
 def deserialize(json):
     asc = dumps(json).encode('ascii')
     c_str = ffi.new('char[]', asc)  # freed by cffi
     obj = lib.verification_aid_new_deserialize(c_str)
     if obj == ffi.cast('struct VerificationAid *', 0):
         raise Exception('could not deserialize')
     return VerificationAid(obj)
예제 #6
0
 def deserialize(json):
     asc = dumps(json).encode('ascii')
     c_str = ffi.new('char[]', asc)  # freed by cffi
     obj = lib.correct_key_proof_new_deserialize(c_str)
     if obj == ffi.cast('struct CorrectKeyProof *', 0):
         raise Exception('could not deserialize')
     return CorrectKeyProof(obj)
예제 #7
0
 def deserialize(json):
     asc = dumps(json).encode('ascii')
     c_str = ffi.new('char[]', asc)  # freed by cffi
     obj = lib.d_log_proof_nullable_new_deserialize(c_str)
     if obj == ffi.cast('struct DLogProof *', 0):
         raise Exception('could not deserialize')
     return DLogProof(obj)
예제 #8
0
 def generate_proof_correct_key(p1pkp, challenge):
     assert type(p1pkp) is P1PaillierKeyPair
     assert type(challenge) is Challenge
     obj = lib.p1_paillier_pair_nullable_generate_proof_correct_key(
         p1pkp.inst, challenge.inst)
     if obj == ffi.cast('struct CorrectKeyProof *', 0):
         raise Exception('could not make correct key proof')
     return CorrectKeyProof(obj)
예제 #9
0
 def verify_and_decommit(p1_keygen1, d_log_proof):
     assert type(d_log_proof) is DLogProof
     assert type(p1_keygen1) is P1KeyGen1
     ptr = lib.p1_keygen2_nullable_new_verify_and_decommit(
         p1_keygen1.inst, d_log_proof.inst)
     if ptr == ffi.cast('struct KeyGenSecondMsg *', 0):
         raise Exception('could not verify_and_decommit')
     return P1KeyGen2(ptr)
예제 #10
0
 def verify_commitments_and_dlog_proof(
     pk_com,
     zk_pok,
     zk_pok_blind,
     public_share,
     pk_com_blind_party,
     d_log_proof,
 ):
     assert type(pk_com) is BigInt
     assert type(zk_pok) is BigInt
     assert type(zk_pok_blind) is BigInt
     assert type(public_share) is GE
     assert type(pk_com_blind_party) is BigInt
     assert type(d_log_proof) is DLogProof
     ptr = lib.p2_keygen2_nullable_new_verify_commitments_and_dlog_proof(
         pk_com.inst, zk_pok.inst, zk_pok_blind.inst, public_share.inst,
         pk_com_blind_party.inst, d_log_proof.inst)
     if ptr == ffi.cast('struct KeyGenSecondMsg *', 0):
         raise Exception('could not verify_commitments_and_dlog_proof')
     return P2KeyGen2(ptr)