/
diev
/
PKISolutions-SSLVerifier.WPF
Обзор
Документация
Войти
/
diev
/
PKISolutions-SSLVerifier.WPF
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
SSLVerifier.Core/Extensions/X509ChainElementCollectionEx.cs
24 строки
965 B
Vadims Podans
added default interface implementations for PS automation and friendlified API calls from PS
13 июл 2020, 18:46
13 июл 2020, 18:46
97ead42
Код
Авторство
О чём код?
using System; using System.Linq; using System.Security.Cryptography.X509Certificates; namespace SSLVerifier.Core.Extensions { static class X509ChainElementCollectionEx { public static Int32 IndexOf(this X509ChainElementCollection collection, X509ChainElement item) { if (collection == null) { return -1; } for (Int32 index = 0; index < collection.Count; index++) { if (collection[index].Certificate.Equals(item.Certificate)) { return index; } } return -1; } public static X509ChainElement Item(this X509ChainElementCollection collection, X509ChainElement item) { return collection.Count == 0 ? null : collection.Cast<X509ChainElement>().FirstOrDefault(x => x.Certificate.Thumbprint == item.Certificate.Thumbprint); } public static Boolean Contains(this X509ChainElementCollection collection, X509ChainElement item) { return collection.Cast<X509ChainElement>().Any(x => item.Certificate.Equals(x.Certificate)); } } }