public static PubKey FromBase58(string base58) { var curve = Curves.GetCurve(base58.Substring(0, 4)); var bytes = Base58.Parse(base58, curve.PrivateKeyPrefix); return(new PubKey(bytes, curve.Kind, true)); }
internal PubKey(byte[] bytes, ECKind kind, bool flush = false) { if (bytes.Length < 32) { throw new ArgumentException("Invalid public key length", nameof(bytes)); } Curve = Curves.GetCurve(kind); Store = new PlainSecretStore(bytes); if (flush) { bytes.Flush(); } }
} //TODO: check key strength internal Key(byte[] bytes, ECKind kind, bool flush = false) { if (bytes.Length < 32) { throw new ArgumentException("Invalid private key length", nameof(bytes)); } Curve = Curves.GetCurve(kind); var privateKey = Curve.GetPrivateKey(bytes); Store = new PlainSecretStore(privateKey); privateKey.Flush(); if (flush) { bytes.Flush(); } }