當前位置: 首頁>>代碼示例>>C#>>正文


C# Certificate.Encode方法代碼示例

本文整理匯總了C#中Org.BouncyCastle.Crypto.Tls.Certificate.Encode方法的典型用法代碼示例。如果您正苦於以下問題:C# Certificate.Encode方法的具體用法?C# Certificate.Encode怎麽用?C# Certificate.Encode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Org.BouncyCastle.Crypto.Tls.Certificate的用法示例。


在下文中一共展示了Certificate.Encode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SendCertificateMessage

        protected virtual void SendCertificateMessage(Certificate certificate)
        {
            if (certificate == null)
            {
                certificate = Certificate.EmptyChain;
            }

            if (certificate.IsEmpty)
            {
                TlsContext context = Context;
                if (!context.IsServer)
                {
                    ProtocolVersion serverVersion = Context.ServerVersion;
                    if (serverVersion.IsSsl)
                    {
                        string errorMessage = serverVersion.ToString() + " client didn't provide credentials";
                        RaiseWarning(AlertDescription.no_certificate, errorMessage);
                        return;
                    }
                }
            }

            HandshakeMessage message = new HandshakeMessage(HandshakeType.certificate);

            certificate.Encode(message);

            message.WriteToRecordStream(this);
        }
開發者ID:JohnMalmsteen,項目名稱:mobile-apps-tower-defense,代碼行數:28,代碼來源:TlsProtocol.cs

示例2: SendClientCertificate

        private void SendClientCertificate(Certificate clientCert)
        {
            MemoryStream bos = new MemoryStream();
            TlsUtilities.WriteUint8((byte)HandshakeType.certificate, bos);

            // Reserve space for length
            TlsUtilities.WriteUint24(0, bos);

            clientCert.Encode(bos);
            byte[] message = bos.ToArray();

            // Patch actual length back in
            TlsUtilities.WriteUint24(message.Length - 4, message, 1);

            rs.WriteMessage(ContentType.handshake, message, 0, message.Length);
        }
開發者ID:MBrekhof,項目名稱:pleiobox-clients,代碼行數:16,代碼來源:TlsProtocolHandler.cs

示例3: GenerateCertificate

 /// <exception cref="IOException"/>
 protected static byte[] GenerateCertificate(Certificate certificate)
 {
     MemoryStream buf = new MemoryStream();
     certificate.Encode(buf);
     return buf.ToArray();
 }
開發者ID:rodrigobrito,項目名稱:bc-csharp,代碼行數:7,代碼來源:DtlsProtocol.cs

示例4: SendClientCertificate

		private void SendClientCertificate(Certificate clientCert)
		{
			MemoryStream bos = new MemoryStream();
			TlsUtilities.WriteUint8((byte)HandshakeType.certificate, bos);
			clientCert.Encode(bos);
			byte[] message = bos.ToArray();

			rs.WriteMessage(ContentType.handshake, message, 0, message.Length);
		}
開發者ID:ktw,項目名稱:OutlookPrivacyPlugin,代碼行數:9,代碼來源:TlsProtocolHandler.cs


注:本文中的Org.BouncyCastle.Crypto.Tls.Certificate.Encode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。