private static string GetPublicKeyFromPrivateKey(string privateKey) { var p = BigInteger.Parse("0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", NumberStyles.HexNumber); var b = (BigInteger)7; var a = BigInteger.Zero; var Gx = BigInteger.Parse("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", NumberStyles.HexNumber); var Gy = BigInteger.Parse("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", NumberStyles.HexNumber); CurveFp curve256 = new CurveFp(p, a, b); Point generator256 = new Point(curve256, Gx, Gy); var secret = BigInteger.Parse(privateKey, NumberStyles.HexNumber); var pubkeyPoint = generator256 * secret; return(pubkeyPoint.X.ToString("X") + pubkeyPoint.Y.ToString("X")); }
public Point(CurveFp curve, BigInteger x, BigInteger y) { this.Curve = curve; this.X = x; this.Y = y; }