latest.ipv8.attestation.wallet.primitives.boneh
Implementation of the Boneh 2-DNF scheme (“Evaluating 2-DNF Formulas on Ciphertexts” by Boneh et al.).
Module Contents
Functions
|
Generate p = l * n - 1 such that: |
|
Generate a bilinear group for two generators. |
Create a random exponentiation of p in message space n. |
|
|
Create a generator for the EC. |
|
A good pairing is not 0 and has order n. |
|
Instead of inspecting torsion points and checking for co-primality: |
|
Generate some primes. Key size in bits. |
|
Generate a keypair for a certain prime bit space. |
|
Encode a message m given a public key. |
|
Decode a ciphertext c given a private key and the possible source messages. |
- latest.ipv8.attestation.wallet.primitives.boneh.generate_prime(n: int) int
- Generate p = l * n - 1 such that:
p is “prime”
p mod 3 = 2
l is an as small as possible positive integer.
- latest.ipv8.attestation.wallet.primitives.boneh.bilinear_group(n: int, p: int, g1x: int, g1y: int, g2x: int, g2y: int) latest.ipv8.attestation.wallet.primitives.value.FP2Value
Generate a bilinear group for two generators.
- latest.ipv8.attestation.wallet.primitives.boneh.get_random_exponentiation(p: latest.ipv8.attestation.wallet.primitives.value.FP2Value, n: int) latest.ipv8.attestation.wallet.primitives.value.FP2Value
Create a random exponentiation of p in message space n.
- latest.ipv8.attestation.wallet.primitives.boneh.get_random_base(n: int) tuple[int, int]
Create a generator for the EC.
- latest.ipv8.attestation.wallet.primitives.boneh.is_good_wp(n: int, wp: latest.ipv8.attestation.wallet.primitives.value.FP2Value) bool
A good pairing is not 0 and has order n.
- latest.ipv8.attestation.wallet.primitives.boneh.get_good_wp(n: int, p: int | None = None) tuple[int, latest.ipv8.attestation.wallet.primitives.value.FP2Value]
Instead of inspecting torsion points and checking for co-primality: just brute force generate pairings until we get a good one.
- Returns:
modulus, weilparing.
- latest.ipv8.attestation.wallet.primitives.boneh.generate_primes(key_size: int = 128) tuple[int, int]
Generate some primes. Key size in bits.
- latest.ipv8.attestation.wallet.primitives.boneh.generate_keypair(key_size: int = 32) tuple[latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey, latest.ipv8.attestation.wallet.primitives.structs.BonehPrivateKey]
Generate a keypair for a certain prime bit space.
- latest.ipv8.attestation.wallet.primitives.boneh.encode(pubkey: latest.ipv8.attestation.wallet.primitives.structs.BonehPublicKey, m: int) latest.ipv8.attestation.wallet.primitives.value.FP2Value
Encode a message m given a public key.
- latest.ipv8.attestation.wallet.primitives.boneh.decode(privkey: latest.ipv8.attestation.wallet.primitives.structs.BonehPrivateKey, msgspace: list[int], c: latest.ipv8.attestation.wallet.primitives.value.FP2Value) int | None
Decode a ciphertext c given a private key and the possible source messages.