<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="6.0.0-preview.3.21201.4" />

ProtectedData

public static class ProtectedData
Provides methods for encrypting and decrypting data. This class cannot be inherited.
public static byte[] Protect(byte[] userData, byte[] optionalEntropy, DataProtectionScope scope)

Encrypts the data in a specified byte array and returns a byte array that contains the encrypted data.

public static byte[] Unprotect(byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope)

Decrypts the data in a specified byte array and returns a byte array that contains the decrypted data.