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

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

戻り値

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

属性

例外

namenullです。

上記以外のすべてのエラー。

注釈

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

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

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

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

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

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

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

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

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

適用対象