X509Certificate2Collectionとは? わかりやすく解説

X509Certificate2Collection クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

X509Certificate2 オブジェクトコレクション表します。このクラス継承できません。

名前空間: System.Security.Cryptography.X509Certificates
アセンブリ: System (system.dll 内)
構文構文

Public Class X509Certificate2Collection
    Inherits X509CertificateCollection
Dim instance As X509Certificate2Collection
public class X509Certificate2Collection : X509CertificateCollection
public ref class X509Certificate2Collection
 : public X509CertificateCollection
public class X509Certificate2Collection extends
 X509CertificateCollection
public class X509Certificate2Collection extends
 X509CertificateCollection
解説解説

X509Certificate2 ストア開いている場合結果X509Certificate2Collection オブジェクト表されます。アンマネージ CAPI (Cryptographic API) の構造精通している場合は、X509Certificate2CollectionX509Certificate2 オブジェクトメモリ ストア考えることができます

使用例使用例

現在のユーザー個人用証明書ストア開いて有効な証明書だけを選択しユーザー証明書選択できるようにして、証明書および証明書チェーン情報コンソール出力するコード例次に示します出力は、ユーザー選択した証明書によって異なります

using System;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.IO;
using System.Security.Cryptography.X509Certificates;

class CertSelect
{
    static void Main()
    {
        try
        {
            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)
                {
                    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();
                }
            store.Close();
            }
        catch (CryptographicException)
            {
                   Console.WriteLine("Information could not be written out for
 this certificate.");
            }
        
    }
}
#using <System.dll>
#using <System.Security.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Permissions;
using namespace System::IO;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   try
   {
      X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser
 );
      store->Open( static_cast<OpenFlags>(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly)
 );
      X509Certificate2Collection ^ collection = dynamic_cast<X509Certificate2Collection^>(store->Certificates);
      X509Certificate2Collection ^ fcollection = dynamic_cast<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 );
      System::Collections::IEnumerator^ myEnum = scollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         X509Certificate2 ^ x509 = safe_cast<X509Certificate2 ^>(myEnum->Current);
         array<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 );
         x509->Reset();
      }
      store->Close();
   }
   catch ( CryptographicException^ ) 
   {
      Console::WriteLine( "Information could not be written out for
 this certificate." );
   }

}

継承階層継承階層
System.Object
   System.Collections.CollectionBase
     System.Security.Cryptography.X509Certificates.X509CertificateCollection
      System.Security.Cryptography.X509Certificates.X509Certificate2Collection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
X509Certificate2Collection メンバ
System.Security.Cryptography.X509Certificates 名前空間

X509Certificate2Collection コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

X509Certificate2 情報指定せずに、X509Certificate2Collection クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography.X509Certificates
アセンブリ: System (system.dll 内)
構文構文

Dim instance As New X509Certificate2Collection
public X509Certificate2Collection ()
public:
X509Certificate2Collection ()
public X509Certificate2Collection ()
public function X509Certificate2Collection
 ()
解説解説
使用例使用例

現在のユーザー個人用証明書ストア開いて有効な証明書だけを選択しユーザー証明書選択できるようにして、証明書および証明書チェーン情報コンソール出力するコード例次に示します出力は、ユーザー選択した証明書によって異なります

using System;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.IO;
using System.Security.Cryptography.X509Certificates;

class CertSelect
{
    static void Main()
    {
        try
        {
            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)
                {
                    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();
                }
            store.Close();
            }
        catch (CryptographicException)
            {
                   Console.WriteLine("Information could not be written out for
 this certificate.");
            }
        
    }
}
#using <System.dll>
#using <System.Security.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Permissions;
using namespace System::IO;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   try
   {
      X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser
 );
      store->Open( static_cast<OpenFlags>(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly)
 );
      X509Certificate2Collection ^ collection = dynamic_cast<X509Certificate2Collection^>(store->Certificates);
      X509Certificate2Collection ^ fcollection = dynamic_cast<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 );
      System::Collections::IEnumerator^ myEnum = scollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         X509Certificate2 ^ x509 = safe_cast<X509Certificate2 ^>(myEnum->Current);
         array<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 );
         x509->Reset();
      }
      store->Close();
   }
   catch ( CryptographicException^ ) 
   {
      Console::WriteLine( "Information could not be written out for
 this certificate." );
   }

}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
X509Certificate2Collection クラス
X509Certificate2Collection メンバ
System.Security.Cryptography.X509Certificates 名前空間

X509Certificate2Collection コンストラクタ (X509Certificate2)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

X509Certificate2 オブジェクト使用して X509Certificate2Collection クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography.X509Certificates
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    certificate As X509Certificate2 _
)
Dim certificate As X509Certificate2

Dim instance As New X509Certificate2Collection(certificate)
public X509Certificate2Collection (
    X509Certificate2 certificate
)
public:
X509Certificate2Collection (
    X509Certificate2^ certificate
)
public X509Certificate2Collection (
    X509Certificate2 certificate
)
public function X509Certificate2Collection
 (
    certificate : X509Certificate2
)

パラメータ

certificate

コレクション最初の X509Certificate2 オブジェクト

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
X509Certificate2Collection クラス
X509Certificate2Collection メンバ
System.Security.Cryptography.X509Certificates 名前空間

X509Certificate2Collection コンストラクタ (X509Certificate2[])

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

X509Certificate2 オブジェクト配列使用して、X509Certificate2Collection クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography.X509Certificates
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    certificates As X509Certificate2() _
)
Dim certificates As X509Certificate2()

Dim instance As New X509Certificate2Collection(certificates)
public X509Certificate2Collection (
    X509Certificate2[] certificates
)
public:
X509Certificate2Collection (
    array<X509Certificate2^>^ certificates
)
public X509Certificate2Collection (
    X509Certificate2[] certificates
)
public function X509Certificate2Collection
 (
    certificates : X509Certificate2[]
)

パラメータ

certificates

X509Certificate2 オブジェクト配列

使用例使用例

現在のユーザー個人用証明書ストア開いて有効な証明書だけを選択しユーザー証明書選択できるようにして、証明書および証明書チェーン情報コンソール出力するコード例次に示します出力は、選択した証明書依存します

using System;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.IO;
using System.Security.Cryptography.X509Certificates;

class CertSelect
{
    static void Main()
    {
        try
        {
            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)
                {
                    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();
                }
            store.Close();
            }
        catch (CryptographicException)
            {
                   Console.WriteLine("Information could not be written out for
 this certificate.");
            }
        
    }
}
#using <System.dll>
#using <System.Security.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Permissions;
using namespace System::IO;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   try
   {
      X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser
 );
      store->Open( static_cast<OpenFlags>(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly)
 );
      X509Certificate2Collection ^ collection = dynamic_cast<X509Certificate2Collection^>(store->Certificates);
      X509Certificate2Collection ^ fcollection = dynamic_cast<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 );
      System::Collections::IEnumerator^ myEnum = scollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         X509Certificate2 ^ x509 = safe_cast<X509Certificate2 ^>(myEnum->Current);
         array<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 );
         x509->Reset();
      }
      store->Close();
   }
   catch ( CryptographicException^ ) 
   {
      Console::WriteLine( "Information could not be written out for
 this certificate." );
   }

}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
X509Certificate2Collection クラス
X509Certificate2Collection メンバ
System.Security.Cryptography.X509Certificates 名前空間

X509Certificate2Collection コンストラクタ (X509Certificate2Collection)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

証明書コレクション指定してX509Certificate2Collection クラス新しインスタンス初期化します。

名前空間: System.Security.Cryptography.X509Certificates
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    certificates As X509Certificate2Collection _
)
Dim certificates As X509Certificate2Collection

Dim instance As New X509Certificate2Collection(certificates)
public X509Certificate2Collection (
    X509Certificate2Collection certificates
)
public:
X509Certificate2Collection (
    X509Certificate2Collection^ certificates
)
public X509Certificate2Collection (
    X509Certificate2Collection certificates
)
public function X509Certificate2Collection
 (
    certificates : X509Certificate2Collection
)

パラメータ

certificates

X509Certificate2Collection オブジェクト

使用例使用例

現在のユーザー個人用証明書ストア開いて有効な証明書だけを選択しユーザー証明書選択できるようにして、証明書および証明書チェーン情報コンソール出力するコード例次に示します出力は、ユーザー選択した証明書によって異なります

using System;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.IO;
using System.Security.Cryptography.X509Certificates;

class CertSelect
{
    static void Main()
    {
        try
        {
            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)
                {
                    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();
                }
            store.Close();
            }
        catch (CryptographicException)
            {
                   Console.WriteLine("Information could not be written out for
 this certificate.");
            }
        
    }
}
#using <System.dll>
#using <System.Security.dll>

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Security::Permissions;
using namespace System::IO;
using namespace System::Security::Cryptography::X509Certificates;
int main()
{
   try
   {
      X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser
 );
      store->Open( static_cast<OpenFlags>(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly)
 );
      X509Certificate2Collection ^ collection = dynamic_cast<X509Certificate2Collection^>(store->Certificates);
      X509Certificate2Collection ^ fcollection = dynamic_cast<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 );
      System::Collections::IEnumerator^ myEnum = scollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         X509Certificate2 ^ x509 = safe_cast<X509Certificate2 ^>(myEnum->Current);
         array<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 );
         x509->Reset();
      }
      store->Close();
   }
   catch ( CryptographicException^ ) 
   {
      Console::WriteLine( "Information could not be written out for
 this certificate." );
   }

}

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
X509Certificate2Collection クラス
X509Certificate2Collection メンバ
System.Security.Cryptography.X509Certificates 名前空間

X509Certificate2Collection コンストラクタ

X509Certificate2Collection クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
X509Certificate2Collection () X509Certificate2 情報指定せずに、X509Certificate2Collection クラス新しインスタンス初期化します。
X509Certificate2Collection (X509Certificate2) X509Certificate2 オブジェクト使用して X509Certificate2Collection クラス新しインスタンス初期化します。
X509Certificate2Collection (X509Certificate2[]) X509Certificate2 オブジェクト配列使用してX509Certificate2Collection クラス新しインスタンス初期化します。
X509Certificate2Collection (X509Certificate2Collection) 証明書コレクション指定してX509Certificate2Collection クラス新しインスタンス初期化します。
参照参照

関連項目

X509Certificate2Collection クラス
X509Certificate2Collection メンバ
System.Security.Cryptography.X509Certificates 名前空間

X509Certificate2Collection プロパティ


パブリック プロパティパブリック プロパティ

( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ Capacity  CollectionBase に格納できる要素の数を取得または設定します。 ( CollectionBase から継承されます。)
パブリック プロパティ Count  CollectionBase インスタンス格納されている要素の数を取得します。このプロパティオーバーライドできません。 ( CollectionBase から継承されます。)
パブリック プロパティ Item 指定したインデックスにある要素取得または設定します
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ InnerList  CollectionBase インスタンス内の要素リスト格納する ArrayList を取得します。 ( CollectionBase から継承されます。)
プロテクト プロパティ List  CollectionBase インスタンス内の要素リスト格納する IList を取得します。 ( CollectionBase から継承されます。)
参照参照

関連項目

X509Certificate2Collection クラス
System.Security.Cryptography.X509Certificates 名前空間

X509Certificate2Collection メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Add オーバーロードされます。 X509Certificate2Collection オブジェクト末尾オブジェクト追加します
パブリック メソッド AddRange オーバーロードされますX509Certificate2Collection オブジェクト複数X509Certificate2 オブジェクト追加します
パブリック メソッド Clear  CollectionBase インスタンスかすべてのオブジェクト削除します。このメソッドオーバーライドできません。 ( CollectionBase から継承されます。)
パブリック メソッド Contains オーバーロードされますX509Certificate2Collection オブジェクト特定の証明書格納されているかどうか確認します
パブリック メソッド CopyTo  1 次元Array インスタンス指定したインデックスに、現在の X509CertificateCollection の X509Certificate 値をコピーします。 ( X509CertificateCollection から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド Export オーバーロードされますコンテンツ タイプ基づいて X.509 証明書情報バイト配列エクスポートます。
パブリック メソッド Find X509FindType 列挙体および findValue オブジェクト指定され検索条件使用してX509Certificate2Collection オブジェクト検索します
パブリック メソッド GetEnumerator X509Certificate2Collection オブジェクト反復処理できる列挙子を返します
パブリック メソッド GetHashCode  現在の X509CertificateCollection格納されているすべての値に基づいたハッシュ値構築します。 ( X509CertificateCollection から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド Import オーバーロードされます証明書X509Certificate2Collection オブジェクトインポートます。
パブリック メソッド IndexOf  現在の X509CertificateCollection 内の指定した X509Certificateインデックス返します。 ( X509CertificateCollection から継承されます。)
パブリック メソッド Insert オーバーロードされますX509Certificate2Collection オブジェクト内の指定したインデックス位置オブジェクト挿入します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド Remove オーバーロードされますX509Certificate2Collection オブジェクト内で最初に見つかった証明書削除します
パブリック メソッド RemoveAt  CollectionBase インスタンス指定したインデックスにある要素削除します。このメソッドオーバーライドできません。 ( CollectionBase から継承されます。)
パブリック メソッド RemoveRange オーバーロードされますX509Certificate2Collection オブジェクトから複数X509Certificate2 オブジェクト削除します
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Finalize  Objectガベージ コレクションにより収集される前に、その Objectリソース解放しその他のクリーンアップ操作実行できるようにします。 ( Object から継承されます。)
プロテクト メソッド MemberwiseClone  現在の Object簡易コピー作成します。 ( Object から継承されます。)
プロテクト メソッド OnClear  CollectionBase インスタンス内容消去するときに、追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnClearComplete  CollectionBase インスタンス内容消去した後に、追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnInsert  CollectionBase インスタンス新し要素挿入する前に追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnInsertComplete  CollectionBase インスタンス新し要素挿入した後に、追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnRemove  CollectionBase インスタンスか要素削除するときに、追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnRemoveComplete  CollectionBase インスタンスか要素削除した後に、追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnSet  CollectionBase インスタンスに値を設定する前に追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnSetComplete  CollectionBase インスタンスに値を設定した後に、追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
プロテクト メソッド OnValidate  値を検証するときに、追加カスタム プロセス実行します。 ( CollectionBase から継承されます。)
参照参照

関連項目

X509Certificate2Collection クラス
System.Security.Cryptography.X509Certificates 名前空間

X509Certificate2Collection メンバ

X509Certificate2 オブジェクトコレクション表します。このクラス継承できません。

X509Certificate2Collection データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド X509Certificate2Collection オーバーロードされます。 X509Certificate2Collection クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ Capacity  CollectionBase格納できる要素の数を取得または設定します。(CollectionBase から継承されます。)
パブリック プロパティ Count  CollectionBase インスタンス格納されている要素の数を取得します。このプロパティオーバーライドできません。(CollectionBase から継承されます。)
パブリック プロパティ Item 指定したインデックスにある要素取得または設定します
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ InnerList  CollectionBase インスタンス内の要素リスト格納する ArrayList を取得します。(CollectionBase から継承されます。)
プロテクト プロパティ List  CollectionBase インスタンス内の要素リスト格納する IList を取得します。(CollectionBase から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Add オーバーロードされますX509Certificate2Collection オブジェクト末尾オブジェクト追加します
パブリック メソッド AddRange オーバーロードされますX509Certificate2Collection オブジェクト複数X509Certificate2 オブジェクト追加します
パブリック メソッド Clear  CollectionBase インスタンスかすべてのオブジェクト削除します。このメソッドオーバーライドできません。 (CollectionBase から継承されます。)
パブリック メソッド Contains オーバーロードされますX509Certificate2Collection オブジェクト特定の証明書格納されているかどうか確認します
パブリック メソッド CopyTo  1 次元Array インスタンス指定したインデックスに、現在の X509CertificateCollection の X509Certificate 値をコピーします。 (X509CertificateCollection から継承されます。)
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド Export オーバーロードされますコンテンツ タイプ基づいて X.509 証明書情報バイト配列エクスポートます。
パブリック メソッド Find X509FindType 列挙体および findValue オブジェクト指定され検索条件使用してX509Certificate2Collection オブジェクト検索します
パブリック メソッド GetEnumerator X509Certificate2Collection オブジェクト反復処理できる列挙子を返します
パブリック メソッド GetHashCode  現在の X509CertificateCollection格納されているすべての値に基づいたハッシュ値構築します。 (X509CertificateCollection から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド Import オーバーロードされます証明書X509Certificate2Collection オブジェクトインポートます。
パブリック メソッド IndexOf  現在の X509CertificateCollection 内の指定した X509Certificateインデックス返します。 (X509CertificateCollection から継承されます。)
パブリック メソッド Insert オーバーロードされますX509Certificate2Collection オブジェクト内の指定したインデックス位置オブジェクト挿入します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド Remove オーバーロードされますX509Certificate2Collection オブジェクト内で最初に見つかった証明書削除します
パブリック メソッド RemoveAt  CollectionBase インスタンス指定したインデックスにある要素削除します。このメソッドオーバーライドできません。 (CollectionBase から継承されます。)
パブリック メソッド RemoveRange オーバーロードされますX509Certificate2Collection オブジェクトから複数X509Certificate2 オブジェクト削除します
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
  名前 説明
プロテクト メソッド Finalize  Objectガベージ コレクションにより収集される前に、その Objectリソース解放しその他のクリーンアップ操作実行できるようにします。 (Object から継承されます。)
プロテクト メソッド MemberwiseClone  現在の Object簡易コピー作成します。 (Object から継承されます。)
プロテクト メソッド OnClear  CollectionBase インスタンス内容消去するときに、追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnClearComplete  CollectionBase インスタンス内容消去した後に、追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnInsert  CollectionBase インスタンス新し要素挿入する前に追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnInsertComplete  CollectionBase インスタンス新し要素挿入した後に、追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnRemove  CollectionBase インスタンスか要素削除するときに、追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnRemoveComplete  CollectionBase インスタンスか要素削除した後に、追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnSet  CollectionBase インスタンスに値を設定する前に追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnSetComplete  CollectionBase インスタンスに値を設定した後に、追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
プロテクト メソッド OnValidate  値を検証するときに、追加カスタム プロセス実行します。 (CollectionBase から継承されます。)
参照参照

関連項目

X509Certificate2Collection クラス
System.Security.Cryptography.X509Certificates 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「X509Certificate2Collection」の関連用語

X509Certificate2Collectionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



X509Certificate2Collectionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS