本文整理汇总了C#中ValidationContext.GetCertificate方法的典型用法代码示例。如果您正苦于以下问题:C# ValidationContext.GetCertificate方法的具体用法?C# ValidationContext.GetCertificate怎么用?C# ValidationContext.GetCertificate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValidationContext
的用法示例。
在下文中一共展示了ValidationContext.GetCertificate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IncorporateCertificateRefs
private void IncorporateCertificateRefs(CompleteCertificateRefs completeCertificateRefs
, ValidationContext ctx)
{
if (ctx.GetNeededCertificates().Count > 1)
{
foreach (CertificateAndContext certificate in ctx.GetNeededCertificates())
{
X509Certificate x509Cert = certificate.GetCertificate();
//jbonilla Don't include signing certificate
if (!x509Cert.Equals(ctx.GetCertificate()))
{
Cert chainCert = new Cert();
chainCert.IssuerSerial.X509IssuerName = x509Cert.IssuerDN.ToString();
chainCert.IssuerSerial.X509SerialNumber = x509Cert.SerialNumber.ToString();
//TODO jbonilla DigestMethod parameter?
chainCert.CertDigest.DigestMethod.Algorithm = SignedXml.XmlDsigSHA1Url;
chainCert.CertDigest.DigestValue = DotNetUtilities.ToX509Certificate2(x509Cert).GetCertHash();
//unsignedProperties.UnsignedSignatureProperties.CompleteCertificateRefs.Id = "CompleteCertificateRefsId-" + this.uid;
completeCertificateRefs.CertRefs.CertCollection.Add(chainCert);
}
}
}
else
{
throw new ArgumentException("Needed certificates empty", "chain");
}
}