System.Security.Cryptography.ProtectedData
Specifies the scope of the data protection to be applied by the method.
The protected data is associated with the current user. Only threads running under the current user context can unprotect the data.
The protected data is associated with the machine context. Any process running on the computer can unprotect data. This enumeration value is usually used in server-specific applications that run on a server where untrusted users are not allowed access.
Provides methods for encrypting and decrypting data. This class cannot be inherited.
Encrypts the data in a specified byte array and returns a byte array that contains the encrypted data.
A byte array that contains data to encrypt.
An optional additional byte array used to increase the complexity of the encryption, or for no additional complexity.
One of the enumeration values that specifies the scope of encryption.
The parameter is .
The encryption failed.
The operating system does not support this method.
The system ran out of memory while encrypting the data.
.NET Core and .NET 5+ only: Calls to the Protect method are supported on Windows operating systems only.
A byte array representing the encrypted data.
Decrypts the data in a specified byte array and returns a byte array that contains the decrypted data.
A byte array containing data encrypted using the method.
An optional additional byte array that was used to encrypt the data, or if the additional byte array was not used.
One of the enumeration values that specifies the scope of data protection that was used to encrypt the data.
The parameter is .
The decryption failed.
The operating system does not support this method.
Out of memory.
.NET Core and .NET 5+ only: Calls to the Unprotect method are supported on Windows operating systems only.
A byte array representing the decrypted data.