/* convert from byte array to point */ public static ECP FromBytes(sbyte[] b) { sbyte[] t = new sbyte[BIG.MODBYTES]; BIG p = new BIG(ROM.Modulus); for (int i = 0; i < BIG.MODBYTES; i++) { t[i] = b[i + 1]; } BIG px = BIG.FromBytes(t); if (BIG.Comp(px, p) >= 0) { return(new ECP()); } if (CURVETYPE == MONTGOMERY) { return(new ECP(px)); } if (b[0] == 0x04) { for (int i = 0; i < BIG.MODBYTES; i++) { t[i] = b[i + BIG.MODBYTES + 1]; } BIG py = BIG.FromBytes(t); if (BIG.Comp(py, p) >= 0) { return(new ECP()); } return(new ECP(px, py)); } if (b[0] == 0x02 || b[0] == 0x03) { return(new ECP(px, (int)(b[0] & 1))); } return(new ECP()); }