Guest User

Untitled

a guest
Jan 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. try
  2. {
  3. X509Certificate theSigner = X509Certificate.CreateFromSignedFile ("c:\r\1.dll");
  4. Console.Write("certificate info :"+ theSigner.GetCertHashString());
  5. }
  6. catch (Exception ex)
  7. {
  8. Console.WriteLine("No digital signature ");
  9. }
  10.  
  11. using System.Security.Cryptography.X509Certificates;
  12.  
  13. namespace ConsoleApp4
  14. {
  15. class Program
  16. {
  17. static void Main(string[] args)
  18. {
  19. //Выбираем и открываем хранилище с сертификатами
  20. var store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
  21. store.Open(OpenFlags.ReadOnly);
  22.  
  23. //Проходим по всем сертификатам и что то с ними делаем
  24. foreach (X509Certificate2 cert in store.Certificates)
  25. {
  26. //В данном участке кода будут все сертификаты из указанного хранилища
  27. }
  28.  
  29. //Закрываем хранилище
  30. store.Close();
  31. }
  32. }
  33. }
Add Comment
Please, Sign In to add comment