DataProtectionProvider Class¶
Contains factory methods for creating an Microsoft.AspNetCore.DataProtection.IDataProtectionProvider
where keys are stored
at a particular location on the file system.
- Namespace
Microsoft.AspNetCore.DataProtection
- Assemblies
- Microsoft.AspNetCore.DataProtection.Extensions
Syntax¶
public class DataProtectionProvider
-
class
Microsoft.AspNetCore.DataProtection.
DataProtectionProvider
Methods¶
-
Create
(System.IO.DirectoryInfo)¶ Creates an
Microsoft.AspNetCore.DataProtection.DataProtectionProvider
given a location at which to store keys.Arguments: keyDirectory (System.IO.DirectoryInfo) – The System.IO.DirectoryInfo
in which keys should be stored. This may represent a directory on a local disk or a UNC share.Return type: Microsoft.AspNetCore.DataProtection.IDataProtectionProvider public static IDataProtectionProvider Create(DirectoryInfo keyDirectory)
-
Create
(System.IO.DirectoryInfo, System.Action<Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder>) Creates an
Microsoft.AspNetCore.DataProtection.DataProtectionProvider
given a location at which to store keys and an optional configuration callback.Arguments: - keyDirectory (System.IO.DirectoryInfo) – The
System.IO.DirectoryInfo
in which keys should be stored. This may represent a directory on a local disk or a UNC share. - setupAction (System.Action<Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder>) – An optional callback which provides further configuration of the data protection
system. See
Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder
for more information.
Return type: public static IDataProtectionProvider Create(DirectoryInfo keyDirectory, Action<IDataProtectionBuilder> setupAction)
- keyDirectory (System.IO.DirectoryInfo) – The
-
Create
(System.IO.DirectoryInfo, System.Action<Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder>, System.Security.Cryptography.X509Certificates.X509Certificate2) Creates an
Microsoft.AspNetCore.DataProtection.DataProtectionProvider
given a location at which to store keys, an optional configuration callback and aSystem.Security.Cryptography.X509Certificates.X509Certificate2
used to encrypt the keys.Arguments: - keyDirectory (System.IO.DirectoryInfo) – The
System.IO.DirectoryInfo
in which keys should be stored. This may represent a directory on a local disk or a UNC share. - setupAction (System.Action<Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder>) – An optional callback which provides further configuration of the data protection
system. See
Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder
for more information. - certificate (System.Security.Cryptography.X509Certificates.X509Certificate2) – The
System.Security.Cryptography.X509Certificates.X509Certificate2
to be used for encryption.
Return type: public static IDataProtectionProvider Create(DirectoryInfo keyDirectory, Action<IDataProtectionBuilder> setupAction, X509Certificate2 certificate)
- keyDirectory (System.IO.DirectoryInfo) – The
-
Create
(System.IO.DirectoryInfo, System.Security.Cryptography.X509Certificates.X509Certificate2) Creates an
Microsoft.AspNetCore.DataProtection.DataProtectionProvider
given a location at which to store keys and aSystem.Security.Cryptography.X509Certificates.X509Certificate2
used to encrypt the keys.Arguments: - keyDirectory (System.IO.DirectoryInfo) – The
System.IO.DirectoryInfo
in which keys should be stored. This may represent a directory on a local disk or a UNC share. - certificate (System.Security.Cryptography.X509Certificates.X509Certificate2) – The
System.Security.Cryptography.X509Certificates.X509Certificate2
to be used for encryption.
Return type: public static IDataProtectionProvider Create(DirectoryInfo keyDirectory, X509Certificate2 certificate)
- keyDirectory (System.IO.DirectoryInfo) – The
-
Create
(System.String) Creates a
Microsoft.AspNetCore.DataProtection.DataProtectionProvider
that store keys in a location based on the platform and operating system.Arguments: applicationName (System.String) – An identifier that uniquely discriminates this application from all other applications on the machine. Return type: Microsoft.AspNetCore.DataProtection.IDataProtectionProvider public static IDataProtectionProvider Create(string applicationName)
-
Create
(System.String, System.Security.Cryptography.X509Certificates.X509Certificate2) Creates a
Microsoft.AspNetCore.DataProtection.DataProtectionProvider
that store keys in a location based on the platform and operating system and uses the givenSystem.Security.Cryptography.X509Certificates.X509Certificate2
to encrypt the keys.Arguments: - applicationName (System.String) – An identifier that uniquely discriminates this application from all other applications on the machine.
- certificate (System.Security.Cryptography.X509Certificates.X509Certificate2) – The
System.Security.Cryptography.X509Certificates.X509Certificate2
to be used for encryption.
Return type: public static IDataProtectionProvider Create(string applicationName, X509Certificate2 certificate)
-