|
이 문서는 기계로 번역한 것입니다. 원본 텍스트를 보려면 포인터를 문서의 문장 위로 올리십시오. 추가 정보
|
번역
원본
|
X509Certificate2Collection.Find 메서드
.NET Framework 4.5
네임스페이스: System.Security.Cryptography.X509Certificates
어셈블리: System(System.dll)
public X509Certificate2Collection Find( X509FindType findType, Object findValue, bool validOnly )
매개 변수
- findType
- 형식: System.Security.Cryptography.X509Certificates.X509FindType
X509FindType 값 중 하나입니다.
- findValue
- 형식: System.Object
개체로서의 검색 조건입니다.
- validOnly
- 형식: System.Boolean
검색에서 유효한 인증서만 반환하려면 true이고, 그렇지 않으면 false입니다.
| 예외 | 조건 |
|---|---|
| CryptographicException |
using System; using System.Security.Cryptography; using System.Security.Permissions; using System.IO; using System.Security.Cryptography.X509Certificates; class CertSelect { static void Main() { X509Store store = new X509Store("MY",StoreLocation.CurrentUser); store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly); X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates; X509Certificate2Collection fcollection = (X509Certificate2Collection)collection.Find(X509FindType.FindByTimeValid,DateTime.Now,false); X509Certificate2Collection scollection = X509Certificate2UI.SelectFromCollection(fcollection, "Test Certificate Select","Select a certificate from the following list to get information on that certificate",X509SelectionFlag.MultiSelection); Console.WriteLine("Number of certificates: {0}{1}",scollection.Count,Environment.NewLine); foreach (X509Certificate2 x509 in scollection) { try { byte[] rawdata = x509.RawData; Console.WriteLine("Content Type: {0}{1}",X509Certificate2.GetCertContentType(rawdata),Environment.NewLine); Console.WriteLine("Friendly Name: {0}{1}",x509.FriendlyName,Environment.NewLine); Console.WriteLine("Certificate Verified?: {0}{1}",x509.Verify(),Environment.NewLine); Console.WriteLine("Simple Name: {0}{1}",x509.GetNameInfo(X509NameType.SimpleName,true),Environment.NewLine); Console.WriteLine("Signature Algorithm: {0}{1}",x509.SignatureAlgorithm.FriendlyName,Environment.NewLine); Console.WriteLine("Private Key: {0}{1}",x509.PrivateKey.ToXmlString(false),Environment.NewLine); Console.WriteLine("Public Key: {0}{1}",x509.PublicKey.Key.ToXmlString(false),Environment.NewLine); Console.WriteLine("Certificate Archived?: {0}{1}",x509.Archived,Environment.NewLine); Console.WriteLine("Length of Raw Data: {0}{1}",x509.RawData.Length,Environment.NewLine); X509Certificate2UI.DisplayCertificate(x509); x509.Reset(); } catch (CryptographicException) { Console.WriteLine("Information could not be written out for this certificate."); } } store.Close(); } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008(서버 코어 역할은 지원되지 않음), Windows Server 2008 R2(서버 코어 역할은 SP1 이상에서 지원, Itanium은 지원되지 않음)
.NET Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.