Ejemplo n.º 1
0
        public PublicKey PublicKeyFromPrivateKey(PrivateKey privateKey)
        {
            if (ECPrivKey.TryCreate(privateKey, Context.Instance, out ECPrivKey? ecprvkey))
            {
                if (ecprvkey != null)
                {
                    ECPubKey    ecpubkey = ecprvkey.CreatePubKey();
                    Span <byte> pub      = stackalloc byte[33];
                    ecpubkey.WriteToSpan(true, pub, out _);
                    return(new PublicKey(pub.ToArray()));
                }
            }

            return(null);
        }
 public void WriteToSpan(Span <byte> out66)
 {
     k1.WriteToSpan(true, out66.Slice(0, 33), out _);
     k2.WriteToSpan(true, out66.Slice(33, 33), out _);
 }