当前位置: 首页>>代码示例>>C#>>正文


C# Certificate.GetCertificateList方法代码示例

本文整理汇总了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 + ")");
     }
 }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:12,代码来源:MockDtlsServer.cs

示例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 + ")");
                }
            }
        }
开发者ID:martijn00,项目名称:BouncyCastle-PCL,代码行数:35,代码来源:TlsTestServerImpl.cs

示例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 + ")");
                    }
                }
            }
开发者ID:martijn00,项目名称:BouncyCastle-PCL,代码行数:26,代码来源:TlsTestClientImpl.cs

示例4: CorruptCertificate

 protected virtual Certificate CorruptCertificate(Certificate cert)
 {
     X509CertificateStructure[] certList = cert.GetCertificateList();
     certList[0] = CorruptCertificateSignature(certList[0]);
     return new Certificate(certList);
 }
开发者ID:martijn00,项目名称:BouncyCastle-PCL,代码行数:6,代码来源:TlsTestClientImpl.cs


注:本文中的Certificate.GetCertificateList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。