public void CertificateSelect01() { foreach (var c in ProcsDE.FindCertificate("store://currentuser/my/CN=OFTP2Test")) { Console.WriteLine(c.Subject); } }
public void CertFind03() { var certs = ProcsDE.FindCertificate("store://cu/root/thumbprint:75e0abb6138512271c04f85fddde38e4b7242efe").ToArray(); //X509KeyUsageExtension a; //a.KeyUsages = X509KeyUsageFlags. Assert.IsTrue(certs.Count() == 1); }
} // proc Dispose #endregion #region -- TryGetState -------------------------------------------------------- private DateTime GetCurrentCertifcateNotAfter(string commonName) { var cert = ProcsDE.FindCertificate("store://lm/my/CN=" + commonName) .OrderByDescending(c => c.NotAfter) .FirstOrDefault(); if (cert == null) { return(DateTime.MinValue); } certificateThumbprint.Value = cert.Thumbprint; certificateNotAfter.Value = cert.NotAfter; return(cert.NotAfter); } // func GetCurrentCertifcateNotAfter
} // proc Dispose protected override void OnBeginReadConfiguration(IDEConfigLoading config) { base.OnBeginReadConfiguration(config); // is there the tcp listener serverTcp = this.GetService <IServerTcp>(true); var useSsl = config.ConfigNew.GetAttribute("ssl", String.Empty); if (String.IsNullOrEmpty(useSsl)) { serverCertificate = null; } else { Log.Info("Try to locate certificate: {0}", useSsl); serverCertificate = (from crt in ProcsDE.FindCertificate(useSsl) orderby crt.NotAfter descending select crt).FirstOrDefault(); if (serverCertificate == null) { throw new ArgumentException("Server certificate not found."); } Log.Info("Locate certificate: {0} {1}", serverCertificate.Thumbprint, serverCertificate.Subject); } } // proc OnBeginReadConfiguration
public void CertFind02() { var certs = ProcsDE.FindCertificate("store://cu/root/subject:CN=GlobalSign").ToArray(); Assert.IsTrue(certs.Count() != 0); }