Share via


SqlConnection.RegisterColumnEncryptionKeyStoreProviders Method

Definition

Registers the column encryption key store providers. This function should only be called once in an app. This does shallow copying of the dictionary so that the app cannot alter the custom provider list once it has been set.

The built-in column master key store providers that are available for the Windows Certificate Store, CNG Store and CSP are pre-registered.

public:
 static void RegisterColumnEncryptionKeyStoreProviders(System::Collections::Generic::IDictionary<System::String ^, Microsoft::Data::SqlClient::SqlColumnEncryptionKeyStoreProvider ^> ^ customProviders);
public static void RegisterColumnEncryptionKeyStoreProviders (System.Collections.Generic.IDictionary<string,Microsoft.Data.SqlClient.SqlColumnEncryptionKeyStoreProvider> customProviders);
static member RegisterColumnEncryptionKeyStoreProviders : System.Collections.Generic.IDictionary<string, Microsoft.Data.SqlClient.SqlColumnEncryptionKeyStoreProvider> -> unit
Public Shared Sub RegisterColumnEncryptionKeyStoreProviders (customProviders As IDictionary(Of String, SqlColumnEncryptionKeyStoreProvider))

Parameters

customProviders
IDictionary<String,SqlColumnEncryptionKeyStoreProvider>

Dictionary of custom column encryption key store providers

Exceptions

A null dictionary was provided.

-or-

A string key in the dictionary was null or empty.

-or-

A SqlColumnEncryptionKeyStoreProvider value in the dictionary was null.

A string key in the dictionary started with "MSSQL_". This prefix is reserved for system providers.

This function was called more than once.

Examples

 Dictionary<string, SqlColumnEncryptionKeyStoreProvider> customKeyStoreProviders = new Dictionary<string, SqlColumnEncryptionKeyStoreProvider>();
 MySqlClientHSMProvider myProvider = new MySqlClientHSMProvider();
 customKeyStoreProviders.Add(@"HSM Provider", myProvider);
 SqlConnection.RegisterColumnEncryptionKeyStoreProviders(customKeyStoreProviders);

Applies to