public static IDataProtectionBuilder ProtectKeysWithDpapiNG(this IDataProtectionBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } return(builder.ProtectKeysWithDpapiNG( protectionDescriptorRule: DpapiNGXmlEncryptor.GetDefaultProtectionDescriptorString(), flags: DpapiNGProtectionDescriptorFlags.None)); }
/// <summary> /// Configures keys to be encrypted with Windows CNG DPAPI before being persisted /// to storage. The keys will be decryptable by the current Windows user account. /// </summary> /// <returns>The 'this' instance.</returns> /// <remarks> /// See https://msdn.microsoft.com/en-us/library/windows/desktop/hh706794(v=vs.85).aspx /// for more information on DPAPI-NG. This API is only supported on Windows 8 / Windows Server 2012 and higher. /// </remarks> public DataProtectionConfiguration ProtectKeysWithDpapiNG() { return(ProtectKeysWithDpapiNG( protectionDescriptorRule: DpapiNGXmlEncryptor.GetDefaultProtectionDescriptorString(), flags: DpapiNGProtectionDescriptorFlags.None)); }