Beispiel #1
0
/* Extract Server Secret SST=S*Q where Q is fixed generator in G2 and S is master secret */
    public static int GET_SERVER_SECRET(sbyte[] S, sbyte[] SST)
    {
        ECP2 Q = new ECP2(new FP2(new BIG(ROM.CURVE_Pxa), new BIG(ROM.CURVE_Pxb)), new FP2(new BIG(ROM.CURVE_Pya), new BIG(ROM.CURVE_Pyb)));

        BIG s = BIG.fromBytes(S);

        Q = PAIR.G2mul(Q, s);
        Q.toBytes(SST);
        return(0);
    }
Beispiel #2
0
/* W=W1+W2 in group G2 */
    public static int RECOMBINE_G2(sbyte[] W1, sbyte[] W2, sbyte[] W)
    {
        ECP2 P = ECP2.fromBytes(W1);
        ECP2 Q = ECP2.fromBytes(W2);

        if (P.is_infinity() || Q.is_infinity())
        {
            return(INVALID_POINT);
        }

        P.add(Q);

        P.toBytes(W);
        return(0);
    }