Beispiel #1
0
/* Outputs H(CID) and H(T|H(CID)) for time permits. If no time permits set HID=HTID */
    public static void SERVER_1(int date, sbyte[] CID, sbyte[] HID, sbyte[] HTID)
    {
        sbyte[] h = hashit(0, CID);
        ECP     R, P = mapit(h);

        if (date != 0)
        {
            if (HID != null)
            {
                P.toBytes(HID);
            }
            h = hashit(date, h);
            R = mapit(h);
            P.add(R);
            P.toBytes(HTID);
        }
        else
        {
            P.toBytes(HID);
        }
    }
Beispiel #2
0
/* R=R1+R2 in group G1 */
    public static int RECOMBINE_G1(sbyte[] R1, sbyte[] R2, sbyte[] R)
    {
        ECP P = ECP.fromBytes(R1);
        ECP Q = ECP.fromBytes(R2);

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

        P.add(Q);

        P.toBytes(R);
        return(0);
    }
Beispiel #3
0
/* Extract PIN from TOKEN for identity CID */
    public static int EXTRACT_PIN(sbyte[] CID, int pin, sbyte[] TOKEN)
    {
        ECP P = ECP.fromBytes(TOKEN);

        if (P.is_infinity())
        {
            return(INVALID_POINT);
        }
        sbyte[] h = hashit(0, CID);
        ECP     R = mapit(h);


        pin %= MAXPIN;

        R = R.pinmul(pin, PBLEN);
        P.sub(R);

        P.toBytes(TOKEN);

        return(0);
    }