public ECPoint CreatePoint(string hex) { if (hex == "00") { return(null); } if (hex.StartsWith("02")) { var x = BigIntegerExt.ParseHexUnsigned(hex.Substring(2)); return(CreatePoint(x, false)); } else if (hex.StartsWith("03")) { var x = BigIntegerExt.ParseHexUnsigned(hex.Substring(2)); return(CreatePoint(x, true)); } else if (hex.StartsWith("04")) { var keySize = (int)KeySize8 * 2; var x = BigIntegerExt.ParseHexUnsigned(hex.Substring(2, keySize)); var y = BigIntegerExt.ParseHexUnsigned(hex.Substring(keySize + 2)); return(CreatePoint(x, y)); } throw new System.FormatException(); }
public static ECPrivateKey ParseHex(string hex, ECCurve curve) { return(new ECPrivateKey(BigIntegerExt.ParseHexUnsigned(hex), curve)); }