sebastinas/pyrelic

e'th modular root (RSA)

Opened this issue · 11 comments

Hi, I'm trying to implement Catalano & Fiore Commitment Scheme based on RSA assumption. I've to compute the e'th root of an integer mod N (since N = p * q two primes number), but with built-in function in python i obtain a float number instead of an integer.
There is any way in your library to evaluate e'th root of integer and get an integer like RSA?
Thank you.

@sebastinas

Note that relic is designed for elliptic curve crypto. pyrelic is probably the wrong pick to implement anything based on RSA.

Okay, so this library is what i was looking for. Because I want to use bilinear pairings on my commitment scheme, but i didn't understand what curves use this library e which method i need to use for:

  • get a generator g of a bilinear group G of prime order p
  • get prime order p
  • obtain a new point on curve by multiplying generator for a scalar
  • use pairing function to get a new point in GT
    I only see some example of scheme like bfe, bls protocol
import pyrelic
# generator
g = pyrelic.generator_G1()
# order
p = pyrelic.order()
# random scalar
scalar = pyrelic.rand_BN_order()
# scalar from an int
scalar = pyrelic.BN_from_int(123)
# h = g^scalar
h = g ** scalar
# pair h with generator of G2
t = pyrelic.pair(h, pyrelic.generator_G2())

In this case is a symmetric pairing? Like tate pairing? Because i need a pairing map which works in this way:
e: G x G -> Gt where G x G are two elements of the same group G
Thank you a lot

That's not supported by pyrelic. It only provides Type-3 pairings as supported by relic.

Ok so G1 and G2 are two generator of different curve? Or same curve?

generator_G1() returns the generator of the group G1, generator_G2() the generator for group G2.

Okok thank you so much. There is any way to cast the output of pyrelic.pair() to string?

Because i try to print the result of g**random_integer but i obtain bytes string (b') and i can't decode it

You can convert the group elements to byte representation. How you convert this representation to a string and back is up to you. Serialization beyond a byte representation is left to the user.