CngKey.Open Metoda

Definicja

Tworzy wystąpienie CngKey obiektu reprezentującego istniejący klucz.

Przeciążenia

Open(String)

Tworzy wystąpienie CngKey obiektu, które reprezentuje istniejący nazwany klucz.

Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

Tworzy wystąpienie CngKey obiektu przy użyciu uchwytu do istniejącego klucza.

Open(String, CngProvider)

Tworzy wystąpienie CngKey obiektu reprezentującego istniejący nazwany klucz przy użyciu określonego dostawcy magazynu kluczy (KSP).

Open(String, CngProvider, CngKeyOpenOptions)

Tworzy wystąpienie CngKey obiektu reprezentującego istniejący nazwany klucz przy użyciu określonego dostawcy magazynu kluczy (KSP) i opcji otwierania klucza.

Open(String)

Źródło:
Cng.NotSupported.cs
Źródło:
Cng.NotSupported.cs
Źródło:
Cng.NotSupported.cs

Tworzy wystąpienie CngKey obiektu, które reprezentuje istniejący nazwany klucz.

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

Parametry

keyName
String

Nazwa klucza.

Zwraca

Istniejący klucz.

Atrybuty

Wyjątki

keyName to null.

Kryptografia nowej generacji (CNG) nie jest obsługiwana w tym systemie.

Wszystkie inne błędy.

Uwagi

To przeciążenie używa następujących wartości domyślnych:

Dotyczy

Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

Źródło:
Cng.NotSupported.cs
Źródło:
Cng.NotSupported.cs
Źródło:
Cng.NotSupported.cs

Tworzy wystąpienie CngKey obiektu przy użyciu uchwytu do istniejącego klucza.

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

Parametry

keyHandle
SafeNCryptKeyHandle

Dojście do istniejącego klucza.

keyHandleOpenOptions
CngKeyHandleOpenOptions

Jedna z wartości wyliczenia wskazująca, czy keyHandle reprezentuje klucz efemeryczny, czy nazwany klucz.

Zwraca

Istniejący klucz.

Atrybuty

Wyjątki

keyHandle to null.

keyHandle jest nieprawidłowy lub źle sformułowany lub jest już zamknięty. Ten wyjątek jest również zgłaszany, jeśli klucz jest kluczem efemerycznym utworzonym przez środowisko uruchomieniowe języka wspólnego (CLR), ale EphemeralKey wartość nie jest określona.

Kryptografia nowej generacji (CNG) nie jest obsługiwana w tym systemie.

Wszystkie inne błędy.

Uwagi

To przeciążenie umożliwia zaawansowanym użytkownikom korzystanie z klas CNG, nawet jeśli polegają na wywołaniu platformy lub zarządzanej funkcji międzyoperacyjnej języka C++. Jeśli na przykład masz bibliotekę natywną, która zwraca klucz jako NCRYPT_KEY_HANDLE, to przeciążenie umożliwia utworzenie zarządzanej otoki wokół klucza i użycie klas CNG do manipulowania nim.

Po otwarciu klucza przy użyciu jego uchwytu nie można określić stanu efemerycznego klucza i musi go określić samodzielnie. Kilka właściwości CngKey klasy polega na tej wartości, aby było poprawne. W związku z tym upewnij się, że do metod przekazano poprawną wartość Open flagi.

Dotyczy

Open(String, CngProvider)

Źródło:
Cng.NotSupported.cs
Źródło:
Cng.NotSupported.cs
Źródło:
Cng.NotSupported.cs

Tworzy wystąpienie CngKey obiektu reprezentującego istniejący nazwany klucz przy użyciu określonego dostawcy magazynu kluczy (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

Parametry

keyName
String

Nazwa klucza.

provider
CngProvider

Dostawcy kluczy, który zawiera klucz.

Zwraca

Istniejący klucz.

Atrybuty

Wyjątki

keyName lub provider ma wartość null.

Kryptografia nowej generacji (CNG) nie jest obsługiwana w tym systemie.

Wszystkie inne błędy.

Uwagi

Open(String) W przeciwieństwie do przeciążenia metody to przeciążenie umożliwia określenie dostawcy. Ponadto jest tworzona wartość domyślna CngKeyOpenOptionsNone i powiązana z kluczem.

Dotyczy

Open(String, CngProvider, CngKeyOpenOptions)

Źródło:
Cng.NotSupported.cs
Źródło:
Cng.NotSupported.cs
Źródło:
Cng.NotSupported.cs

Tworzy wystąpienie CngKey obiektu reprezentującego istniejący nazwany klucz przy użyciu określonego dostawcy magazynu kluczy (KSP) i opcji otwierania klucza.

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

Parametry

keyName
String

Nazwa klucza.

provider
CngProvider

Dostawcy kluczy, który zawiera klucz.

openOptions
CngKeyOpenOptions

Bitowa kombinacja wartości wyliczenia, które określają opcje otwierania klucza, takie jak miejsce otwarcia klucza (magazyn komputera lub użytkownika) i czy pomijać monitowanie interfejsu użytkownika.

Zwraca

Istniejący klucz.

Atrybuty

Wyjątki

keyName lub provider ma wartość null.

Kryptografia nowej generacji (CNG) nie jest obsługiwana w tym systemie.

Wszystkie inne błędy.

Uwagi

Open(String) W przeciwieństwie do przeciążenia metody to przeciążenie umożliwia określenie zarówno dostawcy, jak i opcji otwierania klucza.

Dotyczy