CngKey.Open Método

Definición

Crea una instancia de un objeto CngKey que representa una clave existente.

Sobrecargas

Open(String)

Crea una instancia de un objeto CngKey que representa una clave con nombre existente.

Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

Crea una instancia de un objeto CngKey utilizando un identificador para una clave existente.

Open(String, CngProvider)

Crea una instancia de un objeto CngKey que representa una clave con nombre existente, utilizando el proveedor de almacenamiento de claves (KSP) especificado.

Open(String, CngProvider, CngKeyOpenOptions)

Crea una instancia de un objeto CngKey que representa una clave con nombre existente, utilizando el proveedor de almacenamiento de claves (KSP) especificado y las opciones de apertura de clave.

Open(String)

Crea una instancia de un objeto CngKey que representa una clave con nombre existente.

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

Parámetros

keyName
String

El nombre de la clave.

Devoluciones

CngKey

Clave existente.

Atributos

Excepciones

keyName es null.

Este sistema no es compatible con Cryptography Next Generation (CNG).

Todos los demás errores.

Comentarios

Esta sobrecarga usa los valores predeterminados siguientes:

Se aplica a

Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

Crea una instancia de un objeto CngKey utilizando un identificador para una clave existente.

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

Parámetros

keyHandle
SafeNCryptKeyHandle

Identificador de una clave existente.

keyHandleOpenOptions
CngKeyHandleOpenOptions

Uno de los valores de la enumeración que indica si keyHandle representa una clave efímera o una clave con nombre.

Devoluciones

CngKey

Clave existente.

Atributos

Excepciones

keyHandle es null.

keyHandle no es válido, es incorrecto o ya está cerrado. Esta excepción se produce igualmente si la clave es una clave efímera creada por Common Language Runtime (CLR), pero no se especifica el valor EphemeralKey.

Este sistema no es compatible con Cryptography Next Generation (CNG).

Todos los demás errores.

Comentarios

Esta sobrecarga permite a los usuarios avanzados usar las clases CNG incluso si se basan en la invocación de plataforma o en la funcionalidad de interoperabilidad administrada de C++. Por ejemplo, si tiene una biblioteca nativa que devuelve la clave como un NCRYPT_KEY_HANDLE, esta sobrecarga le permite crear un contenedor administrado alrededor de la clave y usar las clases CNG para manipularla.

Al abrir una clave mediante su identificador, no puede determinar el estado efímero de la clave y debe especificarla usted mismo. Varias propiedades de la CngKey clase dependen de que este valor sea correcto. Por lo tanto, asegúrese de pasar el valor de marca correcto a los Open métodos.

Se aplica a

Open(String, CngProvider)

Crea una instancia de un objeto CngKey que representa una clave con nombre existente, utilizando el proveedor de almacenamiento de claves (KSP) especificado.

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

Parámetros

keyName
String

El nombre de la clave.

provider
CngProvider

KSP que contiene la clave.

Devoluciones

CngKey

Clave existente.

Atributos

Excepciones

keyName o provider es null.

Este sistema no es compatible con Cryptography Next Generation (CNG).

Todos los demás errores.

Comentarios

A diferencia de la sobrecarga del Open(String) método, esta sobrecarga le permite especificar el proveedor. Además, se crea un valor predeterminado CngKeyOpenOptions de None y se enlaza a la clave.

Se aplica a

Open(String, CngProvider, CngKeyOpenOptions)

Crea una instancia de un objeto CngKey que representa una clave con nombre existente, utilizando el proveedor de almacenamiento de claves (KSP) especificado y las opciones de apertura de clave.

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

Parámetros

keyName
String

El nombre de la clave.

provider
CngProvider

KSP que contiene la clave.

openOptions
CngKeyOpenOptions

Una combinación bit a bit de los valores de enumeración que especifican opciones para abrir la clave, como, por ejemplo, desde dónde se abre la clave (almacenamiento de máquinas o usuarios) y si se suprime la solicitud de la IU.

Devoluciones

CngKey

Clave existente.

Atributos

Excepciones

keyName o provider es null.

Este sistema no es compatible con Cryptography Next Generation (CNG).

Todos los demás errores.

Comentarios

A diferencia de la sobrecarga del Open(String) método, esta sobrecarga le permite especificar tanto el proveedor como las opciones de apertura de claves.

Se aplica a