예제 #1
0
 public bool Verify(SignatureSet set, byte[] dataToCheck)
 {
     using (var rsa = new RSACryptoServiceProvider())
     {
         rsa.ImportCspBlob(set.publicKey);
         return(rsa.VerifyData(dataToCheck, hasher, set.signature));
     }
 }
예제 #2
0
        public SignatureSet GetSignature(byte[] data)
        {
            using (var rsa = new RSACryptoServiceProvider())
            {
                var sigSet = new SignatureSet
                {
                    signature = rsa.SignData(data, hasher),
                    publicKey = rsa.ExportCspBlob(false)
                };

                return(sigSet);
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            string message = "Our message";

            byte[] data = Encoding.UTF8.GetBytes(message);

            CyberSignature sig    = new CyberSignature();
            SignatureSet   sigSet = sig.GetSignature(data);

            //data[0] = 222;

            // var result = sig.Verify(sigSet.publicKey, sigSet.signature, data);

            var result = sig.Verify(sigSet, data);

            Console.WriteLine(result);

            Console.ReadLine();
        }