in UProveCrypto/ProtocolHelper.cs [66:116]
internal static FieldZqElement GenerateIssuerParametersCryptoData(IssuerParameters ip, GroupElement[] gValues, bool supportDevice)
{
if (ip == null)
{
throw new ArgumentNullException("ip");
}
if (ip.Gq == null)
{
throw new ArgumentException("Group description is not set");
}
int n = ip.E == null ? 0 : ip.E.Length;
Group Gq = ip.Gq;
ip.G = new GroupElement[n + 2];
FieldZqElement privateKey;
if (gValues == null)
{
FieldZqElement[] y = ip.Zq.GetRandomElements(n + 2, false);
privateKey = y[0];
for (int i = 0; i < (n + 2); i++)
{
ip.G[i] = Gq.G.Exponentiate(y[i]);
}
}
else
{
// g_0
privateKey = ip.Zq.GetRandomElement(false);
ip.G[0] = Gq.G.Exponentiate(privateKey);
// g_1,..,g_n
for (int i = 1; i < (n + 1); i++)
{
ip.G[i] = gValues[i - 1];
}
// g_t
int t = n + 1;
ip.G[t] = gValues[gValues.Length - 1];
}
if (supportDevice)
{
if (ip.Gd == null)
{
ip.Gd = Gq.G.Exponentiate(ip.Zq.GetRandomElement(false));
}
}
return privateKey;
}