Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- namespace Цифровая_подпись
- {
- class Program
- {
- static void Main(string[] args)
- {
- byte[] HashValue = { 59, 4, 248, 102, 77, 97, 142, 201, 210, 12, 224, 93, 25, 41, 100, 197, 213, 134, 130, 135 };
- var RSA = new RSACryptoServiceProvider();
- var RSAFormatter = new RSAPKCS1SignatureFormatter(RSA);
- var RSADeFormatter = new RSAPKCS1SignatureDeformatter(RSA);
- RSAFormatter.SetHashAlgorithm("SHA1");
- var SignedHashValue = RSAFormatter.CreateSignature(HashValue);
- RSADeFormatter.SetHashAlgorithm("SHA1");
- if(RSADeFormatter.VerifySignature(HashValue, SignedHashValue))
- {
- Console.WriteLine("The signature was verified.");
- }
- else
- {
- Console.WriteLine("The signature was not verified.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement