private static X509Certificate2Collection FindDigitalSignatureCertificates(X509Store x509Store)
{
X509Certificate2Collection certificates = x509Store.Certificates.Find(X509FindType.FindByKeyUsage, "nonRepudiation", true);
if (certificates.Count == 0)
{
throw new DigitalSignatureCertificateNotFoundException("No certificate with key usage 'nonRepudiation' found.");
}
return certificates;
}