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

CspKeyContainerInfo クラス

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

暗号化キー ペアに関する追加情報提供します。このクラス継承できません。

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

<ComVisibleAttribute(True)> _
Public NotInheritable Class
 CspKeyContainerInfo
Dim instance As CspKeyContainerInfo
[ComVisibleAttribute(true)] 
public sealed class CspKeyContainerInfo
[ComVisibleAttribute(true)] 
public ref class CspKeyContainerInfo sealed
/** @attribute ComVisibleAttribute(true) */ 
public final class CspKeyContainerInfo
ComVisibleAttribute(true) 
public final class CspKeyContainerInfo
解説解説

このクラス使用してキー コンテナ名やキー番号など、キー ペアに関する追加情報取得します

ランダム キーが RSACryptoServiceProvider または DSACryptoServiceProvider によって生成され場合キー使用するメソッド呼び出すまでキー コンテナ作成されません。CspKeyContainerInfo クラス一部プロパティは、キー コンテナ作成されていない場合に CryptographicException をスローます。

使用例使用例

キー コンテナ作成して、そのコンテナに関する情報取得するコード例次に示します

Imports System
Imports System.Security.Cryptography
Imports System.Text

Module CspKeyContainerInfoExample

    Sub Main(ByVal args() As
 String)
        Dim rsa As New RSACryptoServiceProvider()

        Try
            ' Note: In cases where a random key is generated,   
            ' a key container is not created until you call  
            ' a method that uses the key.  This example calls
            ' the Encrypt method before calling the
            ' CspKeyContainerInfo property so that a key
            ' container is created.  
            ' Create some data to encrypt and display it.
            Dim data As String
 = "Here is some data to encrypt."

            Console.WriteLine("Data to encrypt: "
 + data)

            ' Convert the data to an array of bytes and 
            ' encrypt it.
            Dim byteData As Byte()
 = Encoding.ASCII.GetBytes(data)

            Dim encData As Byte()
 = rsa.Encrypt(byteData, False)

            ' Display the encrypted value.
            Console.WriteLine("Encrypted Data: " +
 Encoding.ASCII.GetString(encData))

            Console.WriteLine()

            Console.WriteLine("CspKeyContainerInfo information:")

            Console.WriteLine()

            ' Create a new CspKeyContainerInfo object.
            Dim keyInfo As CspKeyContainerInfo
 = rsa.CspKeyContainerInfo

            ' Display the value of each property.
            Console.WriteLine("Accessible property: "
 + keyInfo.Accessible.ToString())

            Console.WriteLine("Exportable property: "
 + keyInfo.Exportable.ToString())

            Console.WriteLine("HardwareDevice property: "
 + keyInfo.HardwareDevice.ToString())

            Console.WriteLine("KeyContainerName property: "
 + keyInfo.KeyContainerName)

            Console.WriteLine("KeyNumber property: "
 + keyInfo.KeyNumber.ToString())

            Console.WriteLine("MachineKeyStore property: "
 + keyInfo.MachineKeyStore.ToString())

            Console.WriteLine("Protected property: "
 + keyInfo.Protected.ToString())

            Console.WriteLine("ProviderName property: "
 + keyInfo.ProviderName)

            Console.WriteLine("ProviderType property: "
 + keyInfo.ProviderType.ToString())

            Console.WriteLine("RandomlyGenerated property: "
 + keyInfo.RandomlyGenerated.ToString())

            Console.WriteLine("Removable property: "
 + keyInfo.Removable.ToString())

            Console.WriteLine("UniqueKeyContainerName property:
 " + keyInfo.UniqueKeyContainerName)


        Catch e As Exception
            Console.WriteLine(e.ToString())
        Finally
            ' Clear the key.
            rsa.Clear()
        End Try
        Console.ReadLine()

    End Sub
End Module
using System;
using System.Security.Cryptography;
using System.Text;


public class CspKeyContainerInfoExample
{

    public static void Main(String[]
 args)
    {
        RSACryptoServiceProvider rsa= new RSACryptoServiceProvider();

        try
        {
            // Note: In cases where a random key is generated,   
            // a key container is not created until you call  
            // a method that uses the key.  This example calls
            // the Encrypt method before calling the
            // CspKeyContainerInfo property so that a key
            // container is created.  

            // Create some data to encrypt and display it.
            string data = "Here is some data to encrypt.";

            Console.WriteLine("Data to encrypt: " + data);

            // Convert the data to an array of bytes and 
            // encrypt it.
            byte[] byteData = Encoding.ASCII.GetBytes(data);

            byte[] encData = rsa.Encrypt(byteData, false);

            // Display the encrypted value.
            Console.WriteLine("Encrypted Data: " + Encoding.ASCII.GetString(encData));

            Console.WriteLine();

            Console.WriteLine("CspKeyContainerInfo information:");

            Console.WriteLine();

            // Create a new CspKeyContainerInfo object.
            CspKeyContainerInfo keyInfo = rsa.CspKeyContainerInfo;

            // Display the value of each property.

            Console.WriteLine("Accessible property: " + keyInfo.Accessible);

            Console.WriteLine("Exportable property: " + keyInfo.Exportable);

            Console.WriteLine("HardwareDevice property: " + keyInfo.HardwareDevice);

            Console.WriteLine("KeyContainerName property: " + keyInfo.KeyContainerName);

            Console.WriteLine("KeyNumber property: " + keyInfo.KeyNumber.ToString());

            Console.WriteLine("MachineKeyStore property: " + keyInfo.MachineKeyStore);

            Console.WriteLine("Protected property: " + keyInfo.Protected);

            Console.WriteLine("ProviderName property: " + keyInfo.ProviderName);

            Console.WriteLine("ProviderType property: " + keyInfo.ProviderType);

            Console.WriteLine("RandomlyGenerated property: " + keyInfo.RandomlyGenerated);

            Console.WriteLine("Removable property: " + keyInfo.Removable);

            Console.WriteLine("UniqueKeyContainerName property: " + keyInfo.UniqueKeyContainerName);


        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
        finally
        {
            // Clear the key.
            rsa.Clear();
        }
    }
}
using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Text;
int main()
{
   RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider;
   try
   {
      
      // Note: In cases where a random key is generated,   
      // a key container is not created until you call  
      // a method that uses the key.  This example calls
      // the Encrypt method before calling the
      // CspKeyContainerInfo property so that a key
      // container is created.  
      // Create some data to encrypt and display it.
      String^ data = L"Here is some data to encrypt.";
      Console::WriteLine( L"Data to encrypt: {0}", data );
      
      // Convert the data to an array of bytes and 
      // encrypt it.
      array<Byte>^byteData = Encoding::ASCII->GetBytes( data );
      array<Byte>^encData = rsa->Encrypt( byteData, false
 );
      
      // Display the encrypted value.
      Console::WriteLine( L"Encrypted Data: {0}", Encoding::ASCII->GetString(
 encData ) );
      Console::WriteLine();
      Console::WriteLine( L"CspKeyContainerInfo information:" );
      Console::WriteLine();
      
      // Create a new CspKeyContainerInfo object.
      CspKeyContainerInfo^ keyInfo = rsa->CspKeyContainerInfo;
      
      // Display the value of each property.
      Console::WriteLine( L"Accessible property: {0}", keyInfo->Accessible
 );
      Console::WriteLine( L"Exportable property: {0}", keyInfo->Exportable
 );
      Console::WriteLine( L"HardwareDevice property: {0}", keyInfo->HardwareDevice
 );
      Console::WriteLine( L"KeyContainerName property: {0}", keyInfo->KeyContainerName
 );
      Console::WriteLine( L"KeyNumber property: {0}", keyInfo->KeyNumber
 );
      Console::WriteLine( L"MachineKeyStore property: {0}", keyInfo->MachineKeyStore
 );
      Console::WriteLine( L"Protected property: {0}", keyInfo->Protected
 );
      Console::WriteLine( L"ProviderName property: {0}", keyInfo->ProviderName
 );
      Console::WriteLine( L"ProviderType property: {0}", keyInfo->ProviderType
 );
      Console::WriteLine( L"RandomlyGenerated property: {0}", keyInfo->RandomlyGenerated
 );
      Console::WriteLine( L"Removable property: {0}", keyInfo->Removable
 );
      Console::WriteLine( L"UniqueKeyContainerName property: {0}", keyInfo->UniqueKeyContainerName
 );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( e );
   }
   finally
   {
      
      // Clear the key.
      rsa->Clear();
   }

}

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

CspKeyContainerInfo コンストラクタ

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

パラメータ指定して、CspKeyContainerInfo クラス新しインスタンス初期化します。

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

Public Sub New ( _
    parameters As CspParameters _
)
Dim parameters As CspParameters

Dim instance As New CspKeyContainerInfo(parameters)
public CspKeyContainerInfo (
    CspParameters parameters
)
public:
CspKeyContainerInfo (
    CspParameters^ parameters
)
public CspKeyContainerInfo (
    CspParameters parameters
)
public function CspKeyContainerInfo (
    parameters : CspParameters
)

パラメータ

parameters

キーに関する情報提供する CspParameters オブジェクト

使用例使用例

キー コンテナ作成して、そのコンテナに関する情報取得するコード例次に示します

Imports System
Imports System.Security.Cryptography
Imports System.Text

Module CspKeyContainerInfoExample

    Sub Main(ByVal args() As
 String)
        Dim rsa As New RSACryptoServiceProvider()

        Try
            ' Note: In cases where a random key is generated,   
            ' a key container is not created until you call  
            ' a method that uses the key.  This example calls
            ' the Encrypt method before calling the
            ' CspKeyContainerInfo property so that a key
            ' container is created.  
            ' Create some data to encrypt and display it.
            Dim data As String
 = "Here is some data to encrypt."

            Console.WriteLine("Data to encrypt: "
 + data)

            ' Convert the data to an array of bytes and 
            ' encrypt it.
            Dim byteData As Byte()
 = Encoding.ASCII.GetBytes(data)

            Dim encData As Byte()
 = rsa.Encrypt(byteData, False)

            ' Display the encrypted value.
            Console.WriteLine("Encrypted Data: " +
 Encoding.ASCII.GetString(encData))

            Console.WriteLine()

            Console.WriteLine("CspKeyContainerInfo information:")

            Console.WriteLine()

            ' Create a new CspKeyContainerInfo object.
            Dim keyInfo As CspKeyContainerInfo
 = rsa.CspKeyContainerInfo

            ' Display the value of each property.
            Console.WriteLine("Accessible property: "
 + keyInfo.Accessible.ToString())

            Console.WriteLine("Exportable property: "
 + keyInfo.Exportable.ToString())

            Console.WriteLine("HardwareDevice property: "
 + keyInfo.HardwareDevice.ToString())

            Console.WriteLine("KeyContainerName property: "
 + keyInfo.KeyContainerName)

            Console.WriteLine("KeyNumber property: "
 + keyInfo.KeyNumber.ToString())

            Console.WriteLine("MachineKeyStore property: "
 + keyInfo.MachineKeyStore.ToString())

            Console.WriteLine("Protected property: "
 + keyInfo.Protected.ToString())

            Console.WriteLine("ProviderName property: "
 + keyInfo.ProviderName)

            Console.WriteLine("ProviderType property: "
 + keyInfo.ProviderType.ToString())

            Console.WriteLine("RandomlyGenerated property: "
 + keyInfo.RandomlyGenerated.ToString())

            Console.WriteLine("Removable property: "
 + keyInfo.Removable.ToString())

            Console.WriteLine("UniqueKeyContainerName property:
 " + keyInfo.UniqueKeyContainerName)


        Catch e As Exception
            Console.WriteLine(e.ToString())
        Finally
            ' Clear the key.
            rsa.Clear()
        End Try
        Console.ReadLine()

    End Sub
End Module
using System;
using System.Security.Cryptography;
using System.Text;


public class CspKeyContainerInfoExample
{

    public static void Main(String[]
 args)
    {
        RSACryptoServiceProvider rsa= new RSACryptoServiceProvider();

        try
        {
            // Note: In cases where a random key is generated,   
            // a key container is not created until you call  
            // a method that uses the key.  This example calls
            // the Encrypt method before calling the
            // CspKeyContainerInfo property so that a key
            // container is created.  

            // Create some data to encrypt and display it.
            string data = "Here is some data to encrypt.";

            Console.WriteLine("Data to encrypt: " + data);

            // Convert the data to an array of bytes and 
            // encrypt it.
            byte[] byteData = Encoding.ASCII.GetBytes(data);

            byte[] encData = rsa.Encrypt(byteData, false);

            // Display the encrypted value.
            Console.WriteLine("Encrypted Data: " + Encoding.ASCII.GetString(encData));

            Console.WriteLine();

            Console.WriteLine("CspKeyContainerInfo information:");

            Console.WriteLine();

            // Create a new CspKeyContainerInfo object.
            CspKeyContainerInfo keyInfo = rsa.CspKeyContainerInfo;

            // Display the value of each property.

            Console.WriteLine("Accessible property: " + keyInfo.Accessible);

            Console.WriteLine("Exportable property: " + keyInfo.Exportable);

            Console.WriteLine("HardwareDevice property: " + keyInfo.HardwareDevice);

            Console.WriteLine("KeyContainerName property: " + keyInfo.KeyContainerName);

            Console.WriteLine("KeyNumber property: " + keyInfo.KeyNumber.ToString());

            Console.WriteLine("MachineKeyStore property: " + keyInfo.MachineKeyStore);

            Console.WriteLine("Protected property: " + keyInfo.Protected);

            Console.WriteLine("ProviderName property: " + keyInfo.ProviderName);

            Console.WriteLine("ProviderType property: " + keyInfo.ProviderType);

            Console.WriteLine("RandomlyGenerated property: " + keyInfo.RandomlyGenerated);

            Console.WriteLine("Removable property: " + keyInfo.Removable);

            Console.WriteLine("UniqueKeyContainerName property: " + keyInfo.UniqueKeyContainerName);


        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
        finally
        {
            // Clear the key.
            rsa.Clear();
        }
    }
}
using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Text;
int main()
{
   RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider;
   try
   {
      
      // Note: In cases where a random key is generated,   
      // a key container is not created until you call  
      // a method that uses the key.  This example calls
      // the Encrypt method before calling the
      // CspKeyContainerInfo property so that a key
      // container is created.  
      // Create some data to encrypt and display it.
      String^ data = L"Here is some data to encrypt.";
      Console::WriteLine( L"Data to encrypt: {0}", data );
      
      // Convert the data to an array of bytes and 
      // encrypt it.
      array<Byte>^byteData = Encoding::ASCII->GetBytes( data );
      array<Byte>^encData = rsa->Encrypt( byteData, false
 );
      
      // Display the encrypted value.
      Console::WriteLine( L"Encrypted Data: {0}", Encoding::ASCII->GetString(
 encData ) );
      Console::WriteLine();
      Console::WriteLine( L"CspKeyContainerInfo information:" );
      Console::WriteLine();
      
      // Create a new CspKeyContainerInfo object.
      CspKeyContainerInfo^ keyInfo = rsa->CspKeyContainerInfo;
      
      // Display the value of each property.
      Console::WriteLine( L"Accessible property: {0}", keyInfo->Accessible
 );
      Console::WriteLine( L"Exportable property: {0}", keyInfo->Exportable
 );
      Console::WriteLine( L"HardwareDevice property: {0}", keyInfo->HardwareDevice
 );
      Console::WriteLine( L"KeyContainerName property: {0}", keyInfo->KeyContainerName
 );
      Console::WriteLine( L"KeyNumber property: {0}", keyInfo->KeyNumber
 );
      Console::WriteLine( L"MachineKeyStore property: {0}", keyInfo->MachineKeyStore
 );
      Console::WriteLine( L"Protected property: {0}", keyInfo->Protected
 );
      Console::WriteLine( L"ProviderName property: {0}", keyInfo->ProviderName
 );
      Console::WriteLine( L"ProviderType property: {0}", keyInfo->ProviderType
 );
      Console::WriteLine( L"RandomlyGenerated property: {0}", keyInfo->RandomlyGenerated
 );
      Console::WriteLine( L"Removable property: {0}", keyInfo->Removable
 );
      Console::WriteLine( L"UniqueKeyContainerName property: {0}", keyInfo->UniqueKeyContainerName
 );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( e );
   }
   finally
   {
      
      // Clear the key.
      rsa->Clear();
   }

}

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

CspKeyContainerInfo プロパティ


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

  名前 説明
パブリック プロパティ .NET Compact Framework によるサポート CryptoKeySecurity コンテナ対すアクセス権および監視規則を表す CryptoKeySecurity オブジェクト取得します
パブリック プロパティ .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート UniqueKeyContainerName 一意キー コンテナ名を取得します
参照参照

関連項目

CspKeyContainerInfo クラス
System.Security.Cryptography 名前空間

CspKeyContainerInfo メソッド


CspKeyContainerInfo メンバ

暗号化キー ペアに関する追加情報提供します。このクラス継承できません。

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド CspKeyContainerInfo パラメータ指定して、CspKeyContainerInfo クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ .NET Compact Framework によるサポート CryptoKeySecurity コンテナ対すアクセス権および監視規則を表す CryptoKeySecurity オブジェクト取得します
パブリック プロパティ .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート .NET Compact Framework によるサポート UniqueKeyContainerName 一意キー コンテナ名を取得します
パブリック メソッドパブリック メソッド
参照参照

関連項目

CspKeyContainerInfo クラス
System.Security.Cryptography 名前空間



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

辞書ショートカット

すべての辞書の索引

「CspKeyContainerInfo」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS