'Error using PasswordDeriveBytes.CryptDeriveKey

I'm currently porting an ASP.NET app (.NET 4.8) to ASP.NET Core MVC (3.1)

    internal static ICryptoTransform CreateEncryptor(string Password)
    {
        var des = new TripleDESCryptoServiceProvider();
        var pdb = new PasswordDeriveBytes(Password, new byte[0]);
        des.Key = pdb.CryptDeriveKey("RC2", "MD5", 128, new byte[8]);
        des.IV = new byte[8];
        return des.CreateEncryptor();
    }

this code is used to encrypt something on the url but when used on .net core mvc its returns an error enter image description here

PlatformNotSupportedException:'CryptDeriveKey' requires Windows Cryptiographic API

does anyone know a fix?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source