Skip to content

Commit

Permalink
Try resolve problem with AggregatedProof serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Artemkaaas committed Jun 28, 2017
1 parent ddbcb63 commit e44172f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions anoncreds/protocol/prover.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
InitProof, ProofInput, ProofClaims, \
FullProof, \
Schema, ID, SchemaKey, ClaimRequest, Claims, RequestedProof, AggregatedProof, ProofInfo, AttributeValues
from anoncreds.protocol.utils import get_hash_as_int
from anoncreds.protocol.utils import get_hash_as_int, isCryptoInteger
from anoncreds.protocol.wallet.prover_wallet import ProverWallet
from config.config import cmod

Expand Down Expand Up @@ -249,7 +249,8 @@ async def _prepareProof(self, claims: Dict[SchemaKey, ProofClaims],
initProofs[schemaId] = initProof

# 2. hash
cH = self._get_hash(CList, TauList, nonce)
cH = self._get_hash([int(cmod.toInt(el)) for el in CList if isCryptoInteger(el)],
[int(cmod.toInt(el)) for el in TauList if isCryptoInteger(el)], nonce)

# 3. finalize proofs
proofs = {}
Expand All @@ -268,7 +269,7 @@ async def _prepareProof(self, claims: Dict[SchemaKey, ProofClaims],

proofs[str(schemaId)] = proofInfo

aggregatedProof = AggregatedProof(cH, CList)
aggregatedProof = AggregatedProof(cH, [int(cmod.toInt(el)) for el in CList if isCryptoInteger(el)])

return FullProof(proofs, aggregatedProof, proofRequest)

Expand Down
6 changes: 4 additions & 2 deletions anoncreds/protocol/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from anoncreds.protocol.revocation.accumulators.non_revocation_proof_verifier import \
NonRevocationProofVerifier
from anoncreds.protocol.types import FullProof, ProofInput
from anoncreds.protocol.utils import get_hash_as_int
from anoncreds.protocol.utils import get_hash_as_int, isCryptoInteger
from anoncreds.protocol.wallet.wallet import Wallet
from config.config import cmod

Expand Down Expand Up @@ -53,7 +53,9 @@ async def verify(self, proofInput: ProofInput, proof: FullProof):
proof.aggregatedProof.cHash,
proofItem.proof.primaryProof)

CHver = self._get_hash(proof.aggregatedProof.CList, TauList, proofInput.nonce)
CHver = self._get_hash(proof.aggregatedProof.CList,
[int(cmod.toInt(el)) for el in TauList if isCryptoInteger(el)],
proofInput.nonce)

return CHver == proof.aggregatedProof.cHash

Expand Down

0 comments on commit e44172f

Please sign in to comment.