Ejemplo n.º 1
0
 async def submitAccumulator(self, schemaId: ID,
                             accumPK: AccumulatorPublicKey,
                             accum: Accumulator,
                             tails: TailsType) -> AccumulatorPublicKey:
     accumPK = accumPK._replace(seqId=self._acumPkId)
     self._acumPkId += 1
     await self._cacheValueForId(self._accums, schemaId, accum)
     accumPk = await self._cacheValueForId(self._accumPks, schemaId,
                                           accumPK)
     await self._cacheValueForId(self._tails, schemaId, tails)
     return accumPk
    async def issueAccumulator(self, schemaId, iA, L) \
            -> (
                    Accumulator, TailsType, AccumulatorPublicKey,
                    AccumulatorSecretKey):
        pkR = await self._wallet.getPublicKeyRevocation(schemaId)
        group = cmod.PairingGroup(PAIRING_GROUP)
        gamma = group.random(cmod.ZR)

        g = {}
        gCount = 2 * L
        for i in range(gCount):
            if i != L + 1:
                g[i] = pkR.g ** (gamma ** i)
        z = cmod.pair(pkR.g, pkR.g) ** (gamma ** (L + 1))

        acc = 1
        V = set()

        accPK = AccumulatorPublicKey(z)
        accSK = AccumulatorSecretKey(gamma)
        accum = Accumulator(iA, acc, V, L)
        return accum, g, accPK, accSK
    async def issueAccumulator(self, schemaId, iA, L) \
            -> (Accumulator, Tails, AccumulatorPublicKey,
                    AccumulatorSecretKey):
        pkR = await self._wallet.getPublicKeyRevocation(schemaId)
        group = cmod.PairingGroup(PAIRING_GROUP)
        gamma = group.random(cmod.ZR)

        tails = Tails()
        gCount = 2 * L
        for i in range(gCount):
            if i != L + 1:
                gVal = pkR.g**(gamma**i)
                gPrimeVal = pkR.gprime**(gamma**i)
                tails.addValue(i, gVal, gPrimeVal)
        z = cmod.pair(pkR.g, pkR.gprime)**(gamma**(L + 1))

        acc = 1
        V = set()

        accPK = AccumulatorPublicKey(z)
        accSK = AccumulatorSecretKey(gamma)
        accum = Accumulator(iA, acc, V, L)
        return accum, tails, accPK, accSK