CngKey.Open メソッド

定義

既存のキーを表す CngKey オブジェクトのインスタンスを作成します。

オーバーロード

Open(String)

既存の名前付きキーを表す CngKey オブジェクトのインスタンスを作成します。

Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

既存のキーを識別するハンドルを使用して、CngKey オブジェクトのインスタンスを作成します。

Open(String, CngProvider)

既存の名前付きキーを表す CngKey オブジェクトのインスタンスを、指定した KSP を使用して作成します。

Open(String, CngProvider, CngKeyOpenOptions)

既存の名前付きキーを表す CngKey オブジェクトのインスタンスを、指定した KSP およびキーを開くオプションを使用して作成します。

Open(String)

既存の名前付きキーを表す CngKey オブジェクトのインスタンスを作成します。

public:
 static System::Security::Cryptography::CngKey ^ Open(System::String ^ keyName);
public static System.Security.Cryptography.CngKey Open (string keyName);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Security.Cryptography.CngKey Open (string keyName);
static member Open : string -> System.Security.Cryptography.CngKey
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Open : string -> System.Security.Cryptography.CngKey
Public Shared Function Open (keyName As String) As CngKey

パラメーター

keyName
String

キーの名前です。

戻り値

CngKey

既存のキー。

属性

例外

keyNamenullです。

Cryptography Next Generation (CNG) は、このシステムではサポートされていません。

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

注釈

このオーバーロードでは、次の既定値が使用されます。

適用対象

Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

既存のキーを識別するハンドルを使用して、CngKey オブジェクトのインスタンスを作成します。

public:
 static System::Security::Cryptography::CngKey ^ Open(Microsoft::Win32::SafeHandles::SafeNCryptKeyHandle ^ keyHandle, System::Security::Cryptography::CngKeyHandleOpenOptions keyHandleOpenOptions);
public static System.Security.Cryptography.CngKey Open (Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle keyHandle, System.Security.Cryptography.CngKeyHandleOpenOptions keyHandleOpenOptions);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Security.Cryptography.CngKey Open (Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle keyHandle, System.Security.Cryptography.CngKeyHandleOpenOptions keyHandleOpenOptions);
[System.Security.SecurityCritical]
public static System.Security.Cryptography.CngKey Open (Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle keyHandle, System.Security.Cryptography.CngKeyHandleOpenOptions keyHandleOpenOptions);
static member Open : Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle * System.Security.Cryptography.CngKeyHandleOpenOptions -> System.Security.Cryptography.CngKey
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Open : Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle * System.Security.Cryptography.CngKeyHandleOpenOptions -> System.Security.Cryptography.CngKey
[<System.Security.SecurityCritical>]
static member Open : Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle * System.Security.Cryptography.CngKeyHandleOpenOptions -> System.Security.Cryptography.CngKey
Public Shared Function Open (keyHandle As SafeNCryptKeyHandle, keyHandleOpenOptions As CngKeyHandleOpenOptions) As CngKey

パラメーター

keyHandle
SafeNCryptKeyHandle

既存のキーを識別するハンドル。

keyHandleOpenOptions
CngKeyHandleOpenOptions

keyHandle が短期キーを表しているのか、名前付きキーを表しているのかを示す列挙値の 1 つ。

戻り値

CngKey

既存のキー。

属性

例外

keyHandlenullです。

keyHandle が無効か、形式が正しくないか、または既に閉じられています。 この例外は、キーが CLR で作成された短期キーであり、EphemeralKey 値が指定されていない場合にもスローされます。

Cryptography Next Generation (CNG) は、このシステムではサポートされていません。

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

注釈

このオーバーロードにより、高度なユーザーは、プラットフォーム呼び出しまたは C++ のマネージド相互運用機能に依存している場合でも、CNG クラスを使用できます。 たとえば、NCRYPT_KEY_HANDLEとしてキーを返すネイティブ ライブラリがある場合、このオーバーロードを使用すると、キーの周りにマネージド ラッパーを作成し、CNG クラスを使用して操作できます。

ハンドルを使用してキーを開くと、キーの一時的な状態を特定できず、自分で指定する必要があります。 クラスのいくつかのプロパティは、 CngKey この値が正しいことに依存しています。 そのため、メソッドに正しいフラグ値 Open を渡す必要があります。

適用対象

Open(String, CngProvider)

既存の名前付きキーを表す CngKey オブジェクトのインスタンスを、指定した KSP を使用して作成します。

public:
 static System::Security::Cryptography::CngKey ^ Open(System::String ^ keyName, System::Security::Cryptography::CngProvider ^ provider);
public static System.Security.Cryptography.CngKey Open (string keyName, System.Security.Cryptography.CngProvider provider);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Security.Cryptography.CngKey Open (string keyName, System.Security.Cryptography.CngProvider provider);
static member Open : string * System.Security.Cryptography.CngProvider -> System.Security.Cryptography.CngKey
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Open : string * System.Security.Cryptography.CngProvider -> System.Security.Cryptography.CngKey
Public Shared Function Open (keyName As String, provider As CngProvider) As CngKey

パラメーター

keyName
String

キーの名前です。

provider
CngProvider

キーを格納する KSP。

戻り値

CngKey

既存のキー。

属性

例外

keyName または providernull です。

Cryptography Next Generation (CNG) は、このシステムではサポートされていません。

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

注釈

メソッド オーバーロード Open(String) とは異なり、このオーバーロードではプロバイダーを指定できます。 さらに、既定値 CngKeyOpenOptionsNone 作成され、キーにバインドされます。

適用対象

Open(String, CngProvider, CngKeyOpenOptions)

既存の名前付きキーを表す CngKey オブジェクトのインスタンスを、指定した KSP およびキーを開くオプションを使用して作成します。

public:
 static System::Security::Cryptography::CngKey ^ Open(System::String ^ keyName, System::Security::Cryptography::CngProvider ^ provider, System::Security::Cryptography::CngKeyOpenOptions openOptions);
public static System.Security.Cryptography.CngKey Open (string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions openOptions);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Security.Cryptography.CngKey Open (string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions openOptions);
[System.Security.SecurityCritical]
public static System.Security.Cryptography.CngKey Open (string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions openOptions);
static member Open : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> System.Security.Cryptography.CngKey
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Open : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> System.Security.Cryptography.CngKey
[<System.Security.SecurityCritical>]
static member Open : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> System.Security.Cryptography.CngKey
Public Shared Function Open (keyName As String, provider As CngProvider, openOptions As CngKeyOpenOptions) As CngKey

パラメーター

keyName
String

キーの名前です。

provider
CngProvider

キーを格納する KSP。

openOptions
CngKeyOpenOptions

キーを (コンピューターまたはユーザーの記憶域) から開く場所や UI のプロンプトを抑制するかどうかなど、キーを開くためのオプションを指定する列挙値のビットごとの組み合わせ。

戻り値

CngKey

既存のキー。

属性

例外

keyName または providernull です。

Cryptography Next Generation (CNG) は、このシステムではサポートされていません。

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

注釈

メソッドの Open(String) オーバーロードとは異なり、このオーバーロードを使用すると、プロバイダーとキーオープン オプションの両方を指定できます。

適用対象