1234567891011121314151617181920212223242526272829 |
- def test_localization_of_pseudonym(self):
- name = b" a 16 byte name "
- target = b"PEP3 storage_facility"
- pp = pep3_pb2.Pseudonymizable(data=name,
- state=pep3_pb2.Pseudonymizable.UNENCRYPTED_NAME)
- self.collector.pseudonymize([pp])
- self.collector.relocalize([pp],
- self.config.collector.warrants.to_sf)
- sfp = elgamal.Triple.unpack(pp.data) \
- .decrypt(self.sf.private_keys['pseudonym'])
- pseudonym_secrets = {}
- for peer_secrets in self.secrets.peers.values():
- for shard, shard_secrets in peer_secrets.by_shard.items():
- pseudonym_secrets[shard] \
- = shard_secrets.pseudonym_component_secret
- s = 1
- e = ed25519.scalar_unpack(common.sha256(target))
- for secret in pseudonym_secrets.values():
- s *= pow(ed25519.scalar_unpack(secret), e, ed25519.l)
- s %= ed25519.l
- self.assertEqual(
- sfp * ed25519.scalar_inv(s),
- ed25519.Point.lizard(name))
|