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


C# X509Certificate2.ToString方法代码示例

本文整理汇总了C#中System.Security.Cryptography.X509Certificates.X509Certificate2.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# X509Certificate2.ToString方法的具体用法?C# X509Certificate2.ToString怎么用?C# X509Certificate2.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.Cryptography.X509Certificates.X509Certificate2的用法示例。


在下文中一共展示了X509Certificate2.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFindValue

        /// <summary>
        /// Gets the find value.
        /// </summary>
        /// <param name="findType">Type of the find.</param>
        /// <param name="value">The value.</param>
        /// <returns>The find value formated as string.</returns>
        public static string GetFindValue(X509FindType findType, X509Certificate2 value)
        {
            string findValue = null;

            switch (findType)
            {
                case X509FindType.FindBySubjectDistinguishedName:
                    findValue = GetSubjectDistinguishedName(value.SubjectName.Name);
                    break;
                case X509FindType.FindByThumbprint:
                    findValue = value.Thumbprint;
                    break;
                case X509FindType.FindBySubjectName:
                    findValue = value.SubjectName.Name;
                    break;
                case X509FindType.FindBySerialNumber:
                    findValue = value.SerialNumber;
                    break;
                default:
                    findValue = value.ToString(false);
                    break;
            }

            return findValue;
        }
开发者ID:riseandcode,项目名称:open-wscf-2010,代码行数:31,代码来源:X509CertificateHelper.cs

示例2: Empty_ToString

		public void Empty_ToString ()
		{
			string expected = "System.Security.Cryptography.X509Certificates.X509Certificate2";
			X509Certificate2 x = new X509Certificate2 ();
			Assert.AreEqual (expected, x.ToString (), "ToString()");
			Assert.AreEqual (expected, x.ToString (true), "ToString(true)");
			Assert.AreEqual (expected, x.ToString (false), "ToString(false)");
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:8,代码来源:X509Certificate2Test.cs

示例3: DisplayDetail

        ///////////////////////////////////////////////////////////////////////
        ///
        /// <summary>
        /// Display detail information.
        /// </summary>
        ///
        static void DisplayDetail(string title, X509Certificate2 certificate, bool detached) {
            if (title != null) {
                Console.WriteLine(title);
            }

            Console.WriteLine("Performing " + (detached ? "detached" : "non-detached") + " signature using the following certificate...");
            Console.WriteLine(certificate.ToString(true));
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:14,代码来源:xmlsign.cs

示例4: LoadCertificates

        private X509Certificate2Collection LoadCertificates()
        {
            X509Certificate2Collection collection = new X509Certificate2Collection();

            if(!String.IsNullOrEmpty(this.clientCertFilename))
            {
                Tracer.Debug("Attempting to load Client Certificate from file := " + this.clientCertFilename);
                X509Certificate2 certificate = new X509Certificate2(this.clientCertFilename, this.clientCertPassword);
                Tracer.Debug("Loaded Client Certificate := " + certificate.ToString());

                collection.Add(certificate);
            }
            else
            {
                string name = String.IsNullOrEmpty(this.keyStoreName) ? StoreName.My.ToString() : this.keyStoreName;

                StoreLocation location = StoreLocation.CurrentUser;

                if(!String.IsNullOrEmpty(this.keyStoreLocation))
                {
                    if(String.Compare(this.keyStoreLocation, "CurrentUser", true) == 0)
                    {
                        location = StoreLocation.CurrentUser;
                    }
                    else if(String.Compare(this.keyStoreLocation, "LocalMachine", true) == 0)
                    {
                        location = StoreLocation.LocalMachine;
                    }
                    else
                    {
                        throw new NMSException("Invlalid StoreLocation given on URI");
                    }
                }

                X509Store store = new X509Store(name, location);
                store.Open(OpenFlags.ReadOnly);
                collection = store.Certificates;
                store.Close();
            }

            return collection;
        }
开发者ID:Redi0,项目名称:meijing-ui,代码行数:42,代码来源:SslTransport.cs

示例5: DisplayCertificate

 ///////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Display the certificate to console or using the UI.
 /// </summary>
 static void DisplayCertificate(string title, X509Certificate2 certificate)
 {
     Log.Comment(title);
     if (Verbose.UI == verbose)
     {
         //X509Certificate2UI.DisplayCertificate(certificate);
     }
     else if (Verbose.Detail == verbose)
     {
         Log.Comment(certificate.ToString(true));
     }
     else
     {
         // Normal.
         Log.Comment(certificate.ToString(false));
     }
 }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:21,代码来源:cstore.cs


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