本文整理汇总了C#中Certificate.GetCertificateList方法的典型用法代码示例。如果您正苦于以下问题:C# Certificate.GetCertificateList方法的具体用法?C# Certificate.GetCertificateList怎么用?C# Certificate.GetCertificateList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Certificate
的用法示例。
在下文中一共展示了Certificate.GetCertificateList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NotifyClientCertificate
public override void NotifyClientCertificate(Certificate clientCertificate)
{
X509CertificateStructure[] chain = clientCertificate.GetCertificateList();
Console.WriteLine("DTLS server received client certificate chain of length " + chain.Length);
for (int i = 0; i != chain.Length; i++)
{
X509CertificateStructure entry = chain[i];
// TODO Create fingerprint based on certificate signature algorithm digest
Console.WriteLine(" fingerprint:SHA-256 " + TlsTestUtilities.Fingerprint(entry) + " ("
+ entry.Subject + ")");
}
}
示例2: NotifyClientCertificate
public override void NotifyClientCertificate(Certificate clientCertificate)
{
bool isEmpty = (clientCertificate == null || clientCertificate.IsEmpty);
if (isEmpty != (mConfig.clientAuth == TlsTestConfig.CLIENT_AUTH_NONE))
{
throw new InvalidOperationException();
}
if (isEmpty && (mConfig.serverCertReq == TlsTestConfig.SERVER_CERT_REQ_MANDATORY))
{
throw new TlsFatalAlert(AlertDescription.handshake_failure);
}
X509CertificateStructure[] chain = clientCertificate.GetCertificateList();
// TODO Cache test resources?
if (!isEmpty && !(chain[0].Equals(TlsTestUtilities.LoadCertificateResource("x509-client.pem"))
|| chain[0].Equals(TlsTestUtilities.LoadCertificateResource("x509-client-dsa.pem"))
|| chain[0].Equals(TlsTestUtilities.LoadCertificateResource("x509-client-ecdsa.pem"))))
{
throw new TlsFatalAlert(AlertDescription.bad_certificate);
}
if (TlsTestConfig.DEBUG)
{
Console.WriteLine("TLS server received client certificate chain of length " + chain.Length);
for (int i = 0; i != chain.Length; i++)
{
X509CertificateStructure entry = chain[i];
// TODO Create fingerprint based on certificate signature algorithm digest
Console.WriteLine(" fingerprint:SHA-256 " + TlsTestUtilities.Fingerprint(entry) + " ("
+ entry.Subject + ")");
}
}
}
示例3: NotifyServerCertificate
public virtual void NotifyServerCertificate(Certificate serverCertificate)
{
bool isEmpty = serverCertificate == null || serverCertificate.IsEmpty;
X509CertificateStructure[] chain = serverCertificate.GetCertificateList();
// TODO Cache test resources?
if (isEmpty || !(chain[0].Equals(TlsTestUtilities.LoadCertificateResource("x509-server.pem"))
|| chain[0].Equals(TlsTestUtilities.LoadCertificateResource("x509-server-dsa.pem"))
|| chain[0].Equals(TlsTestUtilities.LoadCertificateResource("x509-server-ecdsa.pem"))))
{
throw new TlsFatalAlert(AlertDescription.bad_certificate);
}
if (TlsTestConfig.DEBUG)
{
Console.WriteLine("TLS client received server certificate chain of length " + chain.Length);
for (int i = 0; i != chain.Length; i++)
{
X509CertificateStructure entry = chain[i];
// TODO Create fingerprint based on certificate signature algorithm digest
Console.WriteLine(" fingerprint:SHA-256 " + TlsTestUtilities.Fingerprint(entry) + " ("
+ entry.Subject + ")");
}
}
}
示例4: CorruptCertificate
protected virtual Certificate CorruptCertificate(Certificate cert)
{
X509CertificateStructure[] certList = cert.GetCertificateList();
certList[0] = CorruptCertificateSignature(certList[0]);
return new Certificate(certList);
}