CngKey.Open Metodo

Definizione

Crea un'istanza di un CngKey oggetto che rappresenta una chiave esistente.

Overload

Nome Descrizione
Open(String)

Crea un'istanza di un CngKey oggetto che rappresenta una chiave denominata esistente.

Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

Crea un'istanza di un CngKey oggetto utilizzando un handle per una chiave esistente.

Open(String, CngProvider)

Crea un'istanza di un CngKey oggetto che rappresenta una chiave denominata esistente usando il provider di archiviazione chiavi (KSP) specificato.

Open(String, CngProvider, CngKeyOpenOptions)

Crea un'istanza di un CngKey oggetto che rappresenta una chiave denominata esistente, usando il provider di archiviazione chiavi (KSP) e le opzioni di apertura della chiave specificate.

Open(String)

Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs

Crea un'istanza di un CngKey oggetto che rappresenta una chiave denominata esistente.

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

Parametri

keyName
String

Nome della chiave.

Valori restituiti

Una chiave esistente.

Attributi

Eccezioni

keyName è null.

La crittografia next generation (CNG) non è supportata in questo sistema.

Tutti gli altri errori.

Commenti

Questo overload usa le impostazioni predefinite seguenti:

Si applica a

Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions)

Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs

Crea un'istanza di un CngKey oggetto utilizzando un handle per una chiave esistente.

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);
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);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Open : Microsoft.Win32.SafeHandles.SafeNCryptKeyHandle * System.Security.Cryptography.CngKeyHandleOpenOptions -> System.Security.Cryptography.CngKey
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

Parametri

keyHandle
SafeNCryptKeyHandle

Handle per una chiave esistente.

keyHandleOpenOptions
CngKeyHandleOpenOptions

Uno dei valori di enumerazione che indica se keyHandle rappresenta una chiave temporanea o una chiave denominata.

Valori restituiti

Una chiave esistente.

Attributi

Eccezioni

keyHandle è null.

keyHandle non è valido o non è valido oppure è già chiuso. Questa eccezione viene generata anche se la chiave è una chiave temporanea creata da Common Language Runtime (CLR), ma il EphemeralKey valore non viene specificato.

La crittografia next generation (CNG) non è supportata in questo sistema.

Tutti gli altri errori.

Commenti

Questo overload consente agli utenti avanzati di usare le classi CNG anche se si basano su platform invoke o sulla funzionalità di interoperabilità gestita di C++. Ad esempio, se si dispone di una libreria nativa che restituisce la chiave come NCRYPT_KEY_HANDLE, questo overload consente di creare un wrapper gestito intorno alla chiave e di usare le classi CNG per modificarla.

Quando si apre una chiave usando il relativo handle, non è possibile determinare lo stato temporaneo della chiave e specificarlo manualmente. Diverse proprietà della CngKey classe si basano su questo valore per essere corrette. Assicurarsi quindi di passare il valore del flag corretto ai Open metodi.

Si applica a

Open(String, CngProvider)

Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs

Crea un'istanza di un CngKey oggetto che rappresenta una chiave denominata esistente usando il provider di archiviazione chiavi (KSP) specificato.

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

Parametri

keyName
String

Nome della chiave.

provider
CngProvider

KSP che contiene la chiave.

Valori restituiti

Una chiave esistente.

Attributi

Eccezioni

keyName o provider è null.

La crittografia next generation (CNG) non è supportata in questo sistema.

Tutti gli altri errori.

Commenti

A differenza dell'overload del Open(String) metodo, questo overload consente di specificare il provider. Inoltre, viene creato un valore predefinito CngKeyOpenOptions di None e associato alla chiave.

Si applica a

Open(String, CngProvider, CngKeyOpenOptions)

Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs
Origine:
Cng.NotSupported.cs

Crea un'istanza di un CngKey oggetto che rappresenta una chiave denominata esistente, usando il provider di archiviazione chiavi (KSP) e le opzioni di apertura della chiave specificate.

public:
 static System::Security::Cryptography::CngKey ^ Open(System::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);
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);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Open : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> System.Security.Cryptography.CngKey
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

Parametri

keyName
String

Nome della chiave.

provider
CngProvider

KSP che contiene la chiave.

openOptions
CngKeyOpenOptions

Combinazione bit per bit dei valori di enumerazione che specificano le opzioni per l'apertura della chiave, ad esempio da dove viene aperta la chiave (computer o archiviazione utente) e se eliminare la richiesta dell'interfaccia utente.

Valori restituiti

Una chiave esistente.

Attributi

Eccezioni

keyName o provider è null.

La crittografia next generation (CNG) non è supportata in questo sistema.

Tutti gli altri errori.

Commenti

A differenza dell'overload del Open(String) metodo, questo overload consente di specificare sia il provider che le opzioni di apertura della chiave.

Si applica a