Skip to main content
. 2023 Mar 4;25(3):454. doi: 10.3390/e25030454
Algorithm 3 Master Keygen
  • Input: 

    Security parameter N, prime q, σ

  • Output: 

    KGC’s public key mpk and secret key msk.

  • 1:

    Start Sample f,gDZN,σ.

  • 2:

    if f>σN or g>σN or fmodq Rq* or gmodqRq* then

  • 3:

        Restart

  • 4:

    end if

  • 5:

    if max((g,f),(gf¯ff¯+gg¯,gg¯ff¯+gg¯))>1.17g then

  • 6:

        Restart

  • 7:

    end if

  • 8:

    Rf=resultant(f,XN+1) and Rg=resultant(g,XN+1), respectively. The resultant of f can be straightforwardly calculated as i=1N1f(Xi) (mod Φ(N)) where Φ(N) is the cyclotomic polynomial Φ(N)=1+X+X2++XN1. The details of the resultant operation can refer to [36]

  • 9:

    Compute ρf,ρf satisfy ρff+kf(XN+1)=Rf, ρgf+kg(XN+1)=Rg by the Extended Euclidean Algorithm where kf and kg are integers.

  • 10:

    if  (Rf,Rg)1  then

  • 11:

        Restart

  • 12:

    end if

  • 13:

    Use the Extended Euclidean Algorithm to find α and β satisfy αRf+βRg=1, that is, we have (αρf)f+(βρg)g=1+k(xN+1).

  • 14:

    Let F=qβρg, G=qαρf, then fGgF=q (mod XN+1)

  • 15:

    return The KGC’s master public key mpk=h=f1g, KGC’s master secret key msk=B=AgAfAGAF, where Ag, Af, AG and AF are anti-circulant matrices, and their ith row consists of the coefficients of the polynomial gximod(XN+1), fximod(XN+1), Gximod(XN+1) and Fximod(XN+1), respectively.