ALTER CRYPTOGRAPHIC PROVIDER (Transact-SQL)

在 SQL Server 中,改變 Extensible Key Management (EKM) 提供者的密碼編譯提供者。

主題連結圖示 Transact-SQL 語法慣例

語法

ALTER CRYPTOGRAPHIC PROVIDER provider_name 
    [ FROM FILE = path_of_DLL ]
    ENABLE | DISABLE

引數

  • provider_name
    Extensible Key Management 提供者的名稱。

  • Path_of_DLL
    實作 SQL Server Extensible Key Management 介面之 .dll 檔的路徑。

  • ENABLE | DISABLE
    啟用或停用提供者。

備註

如果提供者變更 SQL Server 中用來實作 Extensible Key Management 的 .dll 檔案,您必須使用 ALTER CRYPTOGRAPHIC PROVIDER 陳述式。

當使用 ALTER CRYPTOGRAPHIC PROVIDER 陳述式來更新 .dll 檔案路徑時,SQL Server 會執行以下動作:

  • 停用此提供者。

  • 驗證 DLL 簽章,並確認此 .dll 檔案的 GUID 與目錄中記錄的 GUID 相同。

  • 更新此目錄中的 DLL 版本。

當 EKM 提供者設定為 DISABLE 時,任何嘗試透過新連接搭配加密陳述式來使用此提供者的動作都將會失敗。

若要停用提供者,使用此提供者的所有工作階段都必須結束。

當 EKM 提供者 dll 未實作所有必要的方法時,ALTER CRYPTOGRAPHIC PROVIDER 可以傳回錯誤 33085:

One or more methods cannot be found in cryptographic provider library '%.*ls'.

當用來建立 EKM 提供者 dll 的標頭檔過期時,ALTER CRYPTOGRAPHIC PROVIDER 可傳回錯誤 33032:

SQL Crypto API version '%02d. %02d' implemented by provider is not supported. Supported version is '%02d. %02d'.

權限

需要密碼編譯提供者的 CONTROL 權限。

範例

下列範例會在 SQL Server 中,將稱為 SecurityProvider 的密碼編譯提供者更改為更新版的 .dll 檔案。 這個新的版本命名為 c:\SecurityProvider\SecurityProvider_v2.dll,而且會安裝在伺服器上。 您必須將提供者的憑證安裝在伺服器上。

/* First, disable the provider to perform the upgrade.
This will terminate all open cryptographic sessions */
ALTER CRYPTOGRAPHIC PROVIDER SecurityProvider 
DISABLE;
GO

/* Upgrade the provider .dll file. The GUID must the same
as the previous version, but the version can be different. */
ALTER CRYPTOGRAPHIC PROVIDER SecurityProvider
FROM FILE = 'c:\SecurityProvider\SecurityProvider_v2.dll';
GO

/* Enable the upgraded provider. */
ALTER CRYPTOGRAPHIC PROVIDER SecurityProvider 
ENABLE;
GO

請參閱

參考

CREATE CRYPTOGRAPHIC PROVIDER (Transact-SQL)

DROP CRYPTOGRAPHIC PROVIDER (Transact-SQL)

CREATE SYMMETRIC KEY (Transact-SQL)

概念

可延伸金鑰管理 (EKM)