DpapiXmlEncryptor Class

An Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor that encrypts XML by using Windows DPAPI.

Namespace
Microsoft.AspNetCore.DataProtection.XmlEncryption
Assemblies
  • Microsoft.AspNetCore.DataProtection

Syntax

public sealed class DpapiXmlEncryptor : IXmlEncryptor
class Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlEncryptor

Constructors

DpapiXmlEncryptor(System.Boolean)

Creates a Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlEncryptor given a protection scope.

Arguments:protectToLocalMachine (System.Boolean) – ‘true’ if the data should be decipherable by anybody on the local machine, ‘false’ if the data should only be decipherable by the current Windows user account.
public DpapiXmlEncryptor(bool protectToLocalMachine)
DpapiXmlEncryptor(System.Boolean, System.IServiceProvider)

Creates a Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlEncryptor given a protection scope and an System.IServiceProvider.

Arguments:
  • protectToLocalMachine (System.Boolean) – ‘true’ if the data should be decipherable by anybody on the local machine, ‘false’ if the data should only be decipherable by the current Windows user account.
  • services (System.IServiceProvider) – An optional System.IServiceProvider to provide ancillary services.
public DpapiXmlEncryptor(bool protectToLocalMachine, IServiceProvider services)

Methods

Encrypt(System.Xml.Linq.XElement)

Encrypts the specified System.Xml.Linq.XElement.

Arguments:plaintextElement (System.Xml.Linq.XElement) – The plaintext to encrypt.
Return type:Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo
Returns:An Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo that contains the encrypted value of <em>plaintextElement</em> along with information about how to decrypt it.
public EncryptedXmlInfo Encrypt(XElement plaintextElement)