IDataProtectionBuilder 介面

定義

提供資料保護系統的設定存取權,可讓開發人員設定預設的密碼編譯演算法、金鑰儲存位置,以及待用金鑰保護的機制。

public interface class IDataProtectionBuilder
public interface IDataProtectionBuilder
type IDataProtectionBuilder = interface
Public Interface IDataProtectionBuilder

備註

如果開發人員變更待用金鑰保護機制,其預期也會變更金鑰儲存位置,反之亦然。 例如,對 的呼叫 ProtectKeysWithCertificate(IDataProtectionBuilder, String) 通常應該伴隨呼叫 PersistKeysToFileSystem(IDataProtectionBuilder, DirectoryInfo) ,或例外狀況可能會在執行時間發生,因為資料保護系統不知道要保存金鑰的位置。

同樣地,當開發人員修改預設受保護的承載密碼編譯演算法時,他們也應該設定明確的金鑰儲存位置。 因此,呼叫 UseCryptographicAlgorithms(IDataProtectionBuilder, AuthenticatedEncryptorConfiguration) 應該通常會與 的 PersistKeysToFileSystem(IDataProtectionBuilder, DirectoryInfo) 呼叫配對,例如。

當預設密碼編譯演算法或待用金鑰保護機制變更時,它們只會影響存放庫中 的新 金鑰。 存放庫可能包含使用較舊演算法或保護機制的現有金鑰。

屬性

Services

提供傳遞至這個物件建構函式之 的存取 IServiceCollection 權。

擴充方法

PersistKeysToAzureBlobStorage(IDataProtectionBuilder, CloudBlobContainer, String)

設定資料保護系統,將金鑰保存在Azure Blob 儲存體中指定的路徑。

PersistKeysToAzureBlobStorage(IDataProtectionBuilder, CloudBlockBlob)

設定資料保護系統,將金鑰保存在Azure Blob 儲存體中指定的路徑。

PersistKeysToAzureBlobStorage(IDataProtectionBuilder, CloudStorageAccount, String)

設定資料保護系統,將金鑰保存在Azure Blob 儲存體中指定的路徑。

PersistKeysToAzureBlobStorage(IDataProtectionBuilder, CloudBlobContainer, String)

設定資料保護系統,將金鑰保存在Azure Blob 儲存體中指定的路徑。

PersistKeysToAzureBlobStorage(IDataProtectionBuilder, CloudBlockBlob)

設定資料保護系統,將金鑰保存在Azure Blob 儲存體中指定的路徑。

PersistKeysToAzureBlobStorage(IDataProtectionBuilder, CloudStorageAccount, String)

設定資料保護系統,將金鑰保存在Azure Blob 儲存體中指定的路徑。

PersistKeysToAzureBlobStorage(IDataProtectionBuilder, Uri)

設定資料保護系統,將金鑰保存在Azure Blob 儲存體中指定的路徑。

ProtectKeysWithAzureKeyVault(IDataProtectionBuilder, KeyVaultClient, String)

設定資料保護系統,以在 Azure KeyVault 中使用指定的金鑰來保護金鑰。

ProtectKeysWithAzureKeyVault(IDataProtectionBuilder, String, String, X509Certificate2)

設定資料保護系統,以在 Azure KeyVault 中使用指定的金鑰來保護金鑰。

ProtectKeysWithAzureKeyVault(IDataProtectionBuilder, String, String, String)

設定資料保護系統,以在 Azure KeyVault 中使用指定的金鑰來保護金鑰。

AddKeyEscrowSink(IDataProtectionBuilder, IKeyEscrowSink)

IKeyEscrowSink註冊 以在金鑰保存到儲存體之前執行委付。

AddKeyEscrowSink(IDataProtectionBuilder, Func<IServiceProvider,IKeyEscrowSink>)

IKeyEscrowSink註冊 以在金鑰保存到儲存體之前執行委付。

AddKeyEscrowSink<TImplementation>(IDataProtectionBuilder)

IKeyEscrowSink註冊 以在金鑰保存到儲存體之前執行委付。

AddKeyManagementOptions(IDataProtectionBuilder, Action<KeyManagementOptions>)

設定資料保護系統的金鑰管理選項。

DisableAutomaticKeyGeneration(IDataProtectionBuilder)

設定資料保護系統,不要自動產生新的金鑰。

PersistKeysToFileSystem(IDataProtectionBuilder, DirectoryInfo)

設定資料保護系統,將金鑰保存到指定的目錄。 此路徑可能位於本機電腦上,或可能指向 UNC 共用。

PersistKeysToRegistry(IDataProtectionBuilder, RegistryKey)

設定資料保護系統,將金鑰保存到 Windows 登錄。

ProtectKeysWithCertificate(IDataProtectionBuilder, X509Certificate2)

將金鑰設定為在保存至儲存體之前,先將金鑰加密至指定的憑證。

ProtectKeysWithCertificate(IDataProtectionBuilder, String)

將金鑰設定為在保存至儲存體之前,先將金鑰加密至指定的憑證。

ProtectKeysWithDpapi(IDataProtectionBuilder)

將金鑰設定為使用 Windows DPAPI 加密,再保存到儲存體。 加密金鑰只能由目前的 Windows 使用者帳戶解密。

ProtectKeysWithDpapi(IDataProtectionBuilder, Boolean)

將金鑰設定為使用 Windows DPAPI 加密,再保存到儲存體。

ProtectKeysWithDpapiNG(IDataProtectionBuilder)

將金鑰設定為使用 Windows CNG DPAPI 加密,再保存到儲存體。 金鑰將由目前的 Windows 使用者帳戶解密。

ProtectKeysWithDpapiNG(IDataProtectionBuilder, String, DpapiNGProtectionDescriptorFlags)

將金鑰設定為使用 Windows CNG DPAPI 加密,再保存到儲存體。

SetApplicationName(IDataProtectionBuilder, String)

設定資料保護系統內此應用程式的唯一名稱。

SetDefaultKeyLifetime(IDataProtectionBuilder, TimeSpan)

設定資料保護系統所建立金鑰的預設存留期。

UnprotectKeysWithAnyCertificate(IDataProtectionBuilder, X509Certificate2[])

設定可用來解密從儲存體載入的金鑰的憑證。

UseCryptographicAlgorithms(IDataProtectionBuilder, AuthenticatedEncryptionSettings)

設定資料保護系統,以在產生受保護的承載時預設使用指定的密碼編譯演算法。

UseCryptographicAlgorithms(IDataProtectionBuilder, AuthenticatedEncryptorConfiguration)

設定資料保護系統,以在產生受保護的承載時預設使用指定的密碼編譯演算法。

UseCustomCryptographicAlgorithms(IDataProtectionBuilder, CngCbcAuthenticatedEncryptionSettings)

設定資料保護系統以使用自訂 Windows CNG 演算法。 此 API 適用于開發人員無法使用 和 ValidationAlgorithm 列舉中指定的 EncryptionAlgorithm 演算法的進階案例。

UseCustomCryptographicAlgorithms(IDataProtectionBuilder, CngGcmAuthenticatedEncryptionSettings)

設定資料保護系統以使用自訂 Windows CNG 演算法。 此 API 適用于開發人員無法使用 和 ValidationAlgorithm 列舉中指定的 EncryptionAlgorithm 演算法的進階案例。

UseCustomCryptographicAlgorithms(IDataProtectionBuilder, CngCbcAuthenticatedEncryptorConfiguration)

設定資料保護系統以使用自訂 Windows CNG 演算法。 此 API 適用于開發人員無法使用 和 ValidationAlgorithm 列舉中指定的 EncryptionAlgorithm 演算法的進階案例。

UseCustomCryptographicAlgorithms(IDataProtectionBuilder, CngGcmAuthenticatedEncryptorConfiguration)

設定資料保護系統以使用自訂 Windows CNG 演算法。 此 API 適用于開發人員無法使用 和 ValidationAlgorithm 列舉中指定的 EncryptionAlgorithm 演算法的進階案例。

UseCustomCryptographicAlgorithms(IDataProtectionBuilder, ManagedAuthenticatedEncryptorConfiguration)

設定資料保護系統以使用自訂演算法。 此 API 適用于開發人員無法使用 和 ValidationAlgorithm 列舉中指定的 EncryptionAlgorithm 演算法的進階案例。

UseCustomCryptographicAlgorithms(IDataProtectionBuilder, ManagedAuthenticatedEncryptionSettings)

設定資料保護系統以使用自訂演算法。 此 API 適用于開發人員無法使用 和 ValidationAlgorithm 列舉中指定的 EncryptionAlgorithm 演算法的進階案例。

UseEphemeralDataProtectionProvider(IDataProtectionBuilder)

設定資料保護系統以用於 EphemeralDataProtectionProvider 資料保護服務。

PersistKeysToDbContext<TContext>(IDataProtectionBuilder)

設定資料保護系統,將金鑰保存到 EntityFrameworkCore 資料存放區

PersistKeysToRedis(IDataProtectionBuilder, IConnectionMultiplexer)

設定資料保護系統,將金鑰保存在 Redis 資料庫中的預設金鑰 ('DataProtection-Keys')

PersistKeysToRedis(IDataProtectionBuilder, IConnectionMultiplexer, RedisKey)

設定資料保護系統,將金鑰保存到 Redis 資料庫中指定的金鑰

PersistKeysToRedis(IDataProtectionBuilder, Func<IDatabase>, RedisKey)

設定資料保護系統,將金鑰保存到 Redis 資料庫中的指定金鑰

PersistKeysToStackExchangeRedis(IDataProtectionBuilder, IConnectionMultiplexer)

設定資料保護系統,將金鑰保存在 Redis 資料庫中的預設金鑰 ('DataProtection-Keys')

PersistKeysToStackExchangeRedis(IDataProtectionBuilder, IConnectionMultiplexer, RedisKey)

設定資料保護系統,將金鑰保存到 Redis 資料庫中指定的金鑰

PersistKeysToStackExchangeRedis(IDataProtectionBuilder, Func<IDatabase>, RedisKey)

設定資料保護系統,將金鑰保存到 Redis 資料庫中的指定金鑰

適用於