Language

CngKey.GetProperty(String, CngPropertyOptions) メソッド

定義

名前とプロパティ オプションのセットを指定して、プロパティを取得します。

public:
 System::Security::Cryptography::CngProperty GetProperty(System::String ^ name, System::Security::Cryptography::CngPropertyOptions options);
public System.Security.Cryptography.CngProperty GetProperty(string name, System.Security.Cryptography.CngPropertyOptions options);
[System.Security.SecurityCritical]
public System.Security.Cryptography.CngProperty GetProperty(string name, System.Security.Cryptography.CngPropertyOptions options);
member this.GetProperty : string * System.Security.Cryptography.CngPropertyOptions -> System.Security.Cryptography.CngProperty
[<System.Security.SecurityCritical>]
member this.GetProperty : string * System.Security.Cryptography.CngPropertyOptions -> System.Security.Cryptography.CngProperty
Public Function GetProperty (name As String, options As CngPropertyOptions) As CngProperty

パラメーター

name
String

目的のプロパティの名前。

options
CngPropertyOptions

名前付きプロパティのオプションを指定する列挙値のビットごとの組み合わせ。

返品

指定したプロパティの生の値を格納しているオブジェクト。

属性

例外

name は nullです。

その他すべてのエラー。

注釈

このメソッドの目的は、キーの任意のプロパティの値を返することです。 プロパティを取得する一般的な方法は、 CngKey クラスによって提供されるプロパティ アクセサーを使用することです。 CngKey には、一部のプロパティではなく、複数のプロパティのラッパーが用意されています。 GetProperty メソッドは、ラップされていないプロパティの値にアクセスするために主に使用されます。

このメソッドは、次の場合に役立ちます。

  • 新しいバージョンのオペレーティング システムでは、ラッパーがない新しい Cryptography Next Generation (CNG) キー プロパティがサポートされています。

  • カスタム プロパティをキーに追加します。

options パラメーターは、以下を示すために特に使用されます。

  • プロパティが組み込みであるか、カスタムであるか。

  • プロパティをキーで永続化する必要があるかどうか。

これらのオプションは、プロパティが設定された値と一致する必要があります。または、プロパティが見つかりません。

CryptographicException は、プロパティが見つからない場合にスローされます。 HasProperty ブロックでメソッド呼び出しをラップするのではなく、例外を回避するには、最初に try/catch メソッドを呼び出す必要があります。

適用対象