Esempio n. 1
0
        public static bool VerifyAccountSignature(string message, string accountId, string signature)
        {
            if (IsMono)
            {
                return(PortableSignatures.VerifyAccountSignature(message, accountId, signature));
            }

            if (string.IsNullOrWhiteSpace(message) || !ValidateAccountId(accountId) || string.IsNullOrWhiteSpace(signature))
            {
                return(false);
            }

            return(VerifySignature(message, accountId, signature));
        }
Esempio n. 2
0
        public static string GetSignature(string privateKey, string message, string AccountId)
        {
            if (IsMono)
            {
                return(PortableSignatures.GetSignature(privateKey, message));
            }

            var publicKeyBytes  = Base58Encoding.DecodeAccountId(AccountId);
            var privateKeyBytes = Base58Encoding.DecodePrivateKey(privateKey);
            var signature       = Neo.Cryptography.Crypto.Default.Sign(Encoding.UTF8.GetBytes(message), privateKeyBytes, publicKeyBytes);

            return(Base58Encoding.Encode(signature));

            //Neo.Cryptography.ECC.ECDsa sa = new Neo.Cryptography.ECC.ECDsa(privateKeyBytes, Neo.Cryptography.ECC.ECCurve.Secp256r1);
            //var sigInts = sa.GenerateSignature(Encoding.ASCII.GetBytes(message));

            //var sh = new SignatureHolder(sigInts);
            //var signature = sh.ToString();

            ////var vrt = VerifySignature(message, AccountId, signature);

            //return signature;
        }